$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应该说:不可用 我尝试了不同的其他域名,它一直显示它们是高级时可用。任何输入都会非常有用,谢谢
答案 0 :(得分:2)
<?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';
?>
答案 1 :(得分:1)
不幸的是功能:
returns FALSE if no records were found or if an error occurred.
所以“没有结果”并不意味着任何决定性因素。
我还会查找A和CNAME记录,例如:
$dname = "accurst.com";
echo checkdnsrr($dname, "A");
打印1