If we need to make a domain name query for the age of the script can use the following script.
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 O N: (. *)/")," info "= = Array (" Whois.afilias.info ","/created on: (. *)/")," biz "= = Array (" Whois.neulevel.biz ","/do Main 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" = Arr Ay ("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 "= arr Ay ("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 ("WH Ois.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 (str ToLower ($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; The Private function Querywhois ($server, $domain) {$fp = @fsockopen ($server, A, $errno, $errstr,) or Die ("Socke T 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; } }
How do I use it?
Require ("DomainAge.class.php"); $w =new domainage (); echo $w->age ("laodong.me");
This article link: http://www.laodong.me/php-domain-age-checker/