gpt4 book ai didi

php - 通过PHP获取域名到期日期

转载 作者:搜寻专家 更新时间:2023-10-31 22:15:47 25 4
gpt4 key购买 nike

这是我当前的代码:

function get_cmd ()
{
if (file_exists('/usr/local/bin/whois'))
$cmd = '/usr/local/bin/whois';
elseif (file_exists('/usr/bin/whois'))
$cmd = '/usr/bin/whois';
elseif (file_exists('/bin/whois'))
$cmd = '/bin/whois';
else
die('whois shell command does not exist');

return $cmd;
}

function get_whois ($cmd, $domain)
{
if (checkdnsrr($domain))
$result = shell_exec(escapeshellcmd($cmd ." ". $domain));
else
$result = 'DOMAIN IS NOT REGISTERED';

return $result;
}

$cmd = get_cmd();
echo get_whois($cmd, 'google.com');

现在,有没有一种不同的方法可以让我轻松地提取域的到期日期,而不必想出一大堆不同的正则表达式?因为每个域的信息格式都不同...

最佳答案

我已经继续并为此使用了正则表达式。一些注册商甚至不在其 whois 中提供到期日期。

关于php - 通过PHP获取域名到期日期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6601135/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com