您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

PHP查询域名年龄脚本类

2025/1/6 8:30:54发布8次查看
如果我们需要自己做一个域名查询年龄的脚本可以使用下面的脚本。
    class domainage{ private $whois_servers=array( “com” => array(“whois.verisign-grs.com”,”/creation date:(.*)/”), “net” => array(“whois.verisign-grs.com”,”/creation date:(.*)/”), “org” => array(“whois.pir.org”,”/created on:(.*)/”), “info” => array(“whois.afilias.info”,”/created on:(.*)/”), “biz” => array(“whois.neulevel.biz”,”/domain registration date:(.*)/”), “us” => array(“whois.nic.us”,”/domain registration date:(.*)/”), “uk” => array(“whois.nic.uk”,”/registered on:(.*)/”), “ca” => array(“whois.cira.ca”,”/creation date:(.*)/”), “tel” => array(“whois.nic.tel”,”/domain registration date:(.*)/”), “ie” => array(“whois.iedr.ie”,”/registration:(.*)/”), “it” => array(“whois.nic.it”,”/created:(.*)/”), “cc” => array(“whois.nic.cc”,”/creation date:(.*)/”), “ws” => array(“whois.nic.ws”,”/domain created:(.*)/”), “sc” => array(“whois2.afilias-grs.net”,”/created on:(.*)/”), “mobi” => array(“whois.dotmobiregistry.net”,”/created on:(.*)/”), “pro” => array(“whois.registrypro.pro”,”/created on:(.*)/”), “edu” => array(“whois.educause.net”,”/domain record activated:(.*)/”), “tv” => array(“whois.nic.tv”,”/creation date:(.*)/”), “travel” => array(“whois.nic.travel”,”/domain registration date:(.*)/”), “in” => array(“whois.inregistry.net”,”/created on:(.*)/”), “me” => array(“whois.nic.me”,”/domain create date:(.*)/”), “cn” => array(“whois.cnnic.cn”,”/registration date:(.*)/”), “asia” => array(“whois.nic.asia”,”/domain create date:(.*)/”), “ro” => array(“whois.rotld.ro”,”/registered on:(.*)/”), “aero” => array(“whois.aero”,”/created on:(.*)/”), “nu” => array(“whois.nic.nu”,”/created:(.*)/”) ); public function age($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(“/^([-a-z0-9]{2,100})\.([a-z\.]{2,8})$/i”,$domain)) { $domain_parts = explode(“.”, $domain); $tld = strtolower(array_pop($domain_parts)); if(!$server=$this->whois_servers[$tld][0]) { return false; } $res=$this->querywhois($server,$domain); if(preg_match($this->whois_servers[$tld][1],$res,$match)) { date_default_timezone_set(‘utc’); $time = time() ? strtotime($match[1]); $years = floor($time / 31556926); $days = floor(($time % 31556926) / 86400); if($years == “1”) {$y= “1 year”;} else {$y = $years . ” years”;} if($days == “1”) {$d = “1 day”;} else {$d = $days . ” days”;} return “$y, $d”; } else return false; } else return false; } 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 . “\r\n”); $out = “”; while(!feof($fp)){ $out .= fgets($fp); } fclose($fp); return $out; } }
如何使用?
require(“domainage.class.php”); $w=new domainage(); echo $w->age(“laodong.me”);
本文链接:http://www.laodong.me/php-domain-age-checker/
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product