0
$dname = "accurst.com";
$recordexists = checkdnsrr($dname, "ANY");

if ($recordexists) 
  echo $dname." is taken. Sorry!<br>";
else 
  echo $dname." is available!<br>";

这是一个返回错误信息的示例域。它说它可用,但该域名是 2800 美元的高级域名,有什么办法可以表明它不可用,因为它没有与任何人解绑?换句话说,如果我查找:accursttt.com 现在可用,而 accurst.com 应该说:不可用 我尝试了不同的其他域名,它一直显示它们可用,而它们是高级的。任何输入都会非常有帮助谢谢

4

2 回答 2

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';

?>
于 2013-03-04T06:29:22.617 回答
1

不幸的是功能:

returns FALSE if no records were found or if an error occurred.

所以“没有结果”并不意味着任何决定性的事情。

我还会查找 A 和 CNAME 记录,例如:

$dname = "accurst.com";
echo checkdnsrr($dname, "A");

打印 1

于 2013-03-04T06:03:55.500 回答