drake900918 2017-02-06 06:05
浏览 46

套接字错误******* - 无法找到套接字传输“http”

When I try to lookup the domain registrar detail I received the error "Socket Error ******* - Unable to find the socket transport "http"- did you forget to enable it when you configured 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 . "
");
        $out = "";
        while(!feof($fp)){
            $out .= fgets($fp);
        }
    fclose($fp);
    return $out;
}

I am getting the domain name from the different function. Use that domain name in this function and search the whois database for getting the information of the domain registration.

  • 写回答

2条回答 默认 最新

  • duanmu2941 2017-02-06 06:17
    关注

    Just now I found that the lookup is not working only to "ES" and that needs an IP without blacklisted. Limitations mentioned here

    评论

报告相同问题?

悬赏问题

  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥20 测距传感器数据手册i2c