Maison  >  Article  >  développement back-end  >  whois PHP实现域名whois查询的代码数据源万网、新网

whois PHP实现域名whois查询的代码数据源万网、新网

WBOY
WBOYoriginal
2016-07-29 08:41:591716parcourir

万网 whois(使用的接口为万网提供合法接口)

复制代码 代码如下:


function whois_hichina($domain) {
preg_match("|

(.+?)
|is", @file_get_contents('http://whois.hichina.com/cgi-bin/whois?domain='.$domain.''), $whois);
$whois[0] = str_replace('友情提示:按注册局要求,过期域名可能会处于注册商自动续费期阶段,您在此查询所看到的域名到期日仅供参考
请您进入会员区查看该域名的实际到期时间,并请及时进行续费,谢谢!', '', ($whois[0]));//过滤掉此段文字
return $whois[0]);
}

  新网 whois (非新网提供,只是根据新网自身网站的url修改实现)

复制代码 代码如下:


function whois_xinnet($domain) {
preg_match("|

(.+?)
|is", @file_get_contents('http://www.xinnet.cn/Modules/agent/serv/pages/domain_whois.jsp?domainNameWhois='.$domain.'&noCode=noCode'), $whois);
return $whois[0];
}
}

  上海电信测试,感觉新网的查询要快一点,且万网有些域名查询不出来的,新网亦可以查询到!

以上就介绍了whois PHP实现域名whois查询的代码数据源万网、新网,包括了whois方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

Déclaration:
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn