本文介绍了checkdnsrr() 返回错误信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$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 应该说:不可用我尝试了其他不同的域名,但它一直显示它们可用,而它们是优质的.任何输入都会非常有帮助,谢谢

this is an example domain that returns the wrong info. It says its available butthe domain is a premium domain name of 2800 dollarsis there any way for it to show that it's not available since it is not untied to anyone?in other words if I look up: accurstttt.com now that's availableand accurst.com should say : not availablei tried different other domain names and it keeps showing they are available while they are premium. any input would be very helpful thank you

推荐答案

<?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."
");

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

?>

这篇关于checkdnsrr() 返回错误信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-02 01:41