$dname = "accurst.com";
$recordexists = checkdnsrr($dname, "ANY");
if ($recordexists)
echo $dname." is taken. Sorry!<br>";
else
echo $dname." is available!<br>";这是一个返回错误信息的示例域名。它说它是可用的,但域名是2800美元的高级域名,有没有办法让它表明它是不可用的,因为它没有解绑到任何人?换句话说,如果我查一下: accurstttt.com,现在是可用的,accurst.com应该会说:不可用,我尝试了不同的其他域名,但它一直显示它们是可用的,而它们是高级的。任何意见都很有帮助,谢谢
发布于 2013-03-04 14:29:23
<?php
function checkDomainAvailability($domain_name){
$server = 'whois.crsnic.net';
// Open a socket connection to the whois server
$connection = fsockopen($server, 43);
if (!$connection) return false;
// Send the requested doman name
fputs($connection, $domain_name."\r\n");
// Read and store the server response
$response_text = ' :';
while(!feof($connection)) {
$response_text .= fgets($connection,128);
}
// Close the connection
fclose($connection);
// Check the response stream whether the domain is available
if (strpos($response_text, 'No match for')) return true;
else return false;
}
$domainname = 'accurst.com';
if(checkDomainAvailability($domainname)) echo 'Domain : '.$domainname.' is Available';
else echo 'Domain : '.$domainname.' is Already Taken';
?>发布于 2013-03-04 14:03:56
不幸的是,这个函数:
returns FALSE if no records were found or if an error occurred.所以“没有结果”并不意味着什么决定性的东西。
我还会查找A和CNAME记录,例如:
$dname = "accurst.com";
echo checkdnsrr($dname, "A");打印1
https://stackoverflow.com/questions/15195396
复制相似问题