fsockopen正在超时

时间:2014-06-22 17:45:02

标签: php timeout fsockopen whois

我正在关注脚本,以便我可以批量检查域名。我只使用了大约10个域名想法尝试了这一点并且它有效。但是现在我试图用成千上万的域名想法运行它,但它只是加载了一段时间然后转到404

这是我的功能

function is_avail($domain) 
{     
    $pieces = explode(".", $domain); 
    $server = (count($pieces) == 2) ? $pieces[1] : $pieces[1] . "." . $pieces[2]; 
    $server .= ".whois-servers.net"; 
    $fp = fsockopen($server, 43, $errno, $errstr, 10); 
    $result = ""; 
    if($fp === FALSE){ return FALSE; } 
    fputs($fp, $domain . "\r\n");     
    while(!feof($fp)){ $result .= fgets($fp, 128); } 
    fclose($fp); 

    return ((stristr($result, 'no match for') !== FALSE) || (strtolower($result) == "notfound\n")) ? TRUE : FALSE; 
} 

有没有办法让这个工作或whois-servers.net有限制?

1 个答案:

答案 0 :(得分:0)

我相信您收到404错误导致您的代码中的网址错误;将whois-servers.net更改为whois-server.net。然后,在while循环中添加一个计数器,您将获得限制。否则,有人说每日限制为100,其他每个ip查询1000次。