下面是我当前的代码:
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');现在,有没有一种不同的方法,可以让我轻松地提取域名的到期日期,而不必想出一大堆不同的正则表达式?由于每个域的信息格式都不同...
发布于 2011-07-07 08:12:08
我继续使用正则表达式来实现这一点。一些注册商甚至没有在他们的whois中提供过期日期。
发布于 2012-04-05 14:06:02
此代码将为您提供到期日期
<?
$detail = "whois " . $_GET['domain'];
$res = shell_exec($detail);
$start = strpos($res,"Expiration");
echo substr($res,$start+16,11);
?>https://stackoverflow.com/questions/6601135
复制相似问题