套接字错误 ******* - 找不到套接字传输"http"



当我尝试查找域注册商详细信息时,我收到错误"套接字错误******* - 找不到套接字传输"http" - 您在配置 PHP 时忘记启用它了吗?

public function whoislookup($domain){
$domain = trim($domain); //remove space from start and end of domain
if(substr(strtolower($domain), 0, 7) == "http://") $domain = substr($domain, 7); // remove http:// if included
if(substr(strtolower($domain), 0, 4) == "www.") $domain = substr($domain, 4);//remove www from domain
if(preg_match("/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]).){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/",$domain))
    return $this->queryWhois("whois.lacnic.net",$domain);
elseif(preg_match("/^([-a-z0-9]{2,100}).([a-z.]{2,8})$/i",$domain))
{
    $domain_parts = explode(".", $domain);
    $tld = strtolower(array_pop($domain_parts));
    $server = $this->WHOIS_SERVERS[$tld][0];
    if(!$server) {
        return "Error: No appropriate Whois server found for $domain domain!";
    }
    $res=$this->queryWhois($server,$domain);
        while(preg_match_all("/Whois Server: (.*)/", $res, $matches))
        {
            $server=array_pop($matches[1]);
            $res=$this->queryWhois($server,$domain);
        }
    return $res;
}
else
return "Invalid Input";}
private function queryWhois($server,$domain)
{
    $fp = @fsockopen($server, 43, $errno, $errstr, 20) or die("Socket Error " . $errno . " - " . $errstr);
    if($server=="whois.verisign-grs.com")
        $domain="=".$domain;
        fputs($fp, $domain . "rn");
        $out = "";
        while(!feof($fp)){
            $out .= fgets($fp);
        }
    fclose($fp);
    return $out;
}

我正在从不同的功能中获取域名。在此函数中使用该域名并搜索whois数据库以获取域注册的信息。

刚才我发现查找不仅对"ES"有效,而且需要一个没有黑名单的 IP。此处提到的限制

如何使用套接字方法加快上述代码的数据传输速度。

谢谢维杰

最新更新