0

我一直在使用这个方法

我已经在我的网站上设置了它,但由于某种原因,它似乎不适用于所有扩展。正如我设置的那样,我确实在我的网站上设置了该代码,但对其进行了修改以检查请求的域名。

你可以在我的网站上试试。

所以在这里你可以看到一些工作示例:
try: just.com、just.net、example.com 和 test.com。

一些不起作用的示例:
尝试:just.dk、example.dk 和 test.dk

这是我在网站上的完整代码:

    <?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 (isset($_GET['domain']))
        $domainname = $_GET['domain'];

    if(checkDomainAvailability($domainname)) echo 'Domain : '.$domainname.' is Available';
    else echo 'Domain : '.$domainname.' is Already Taken';

?>

有谁知道如何解决这个问题?

4

1 回答 1

0

可能是因为 whois 服务器不支持那些顶级域。看看谁的

于 2013-09-24T07:29:10.940 回答