function Whois_query ($domain) { Fix the domain name: $domain = Strtolower (Trim ($domain)); $domain = preg_replace ('/^http:\/\//i ', ' ', $domain); $domain = preg_replace ('/^www\./i ', ' ', $domain); $domain = explode ('/', $domain); $domain = Trim ($domain [0]); Split the TLD from domain name $_domain = Explode ('. ', $domain); $lst = count ($_domain)-1; $ext = $_domain[$lst]; You find resources and lists Like these on Wikipedia: // Http://de.wikipedia.org/wiki/Whois // $servers = Array ( "Biz" = "whois.neulevel.biz", "com" = "whois.internic.net", "Us" = "whois.nic.us", "Coop" = "Whois.nic.coop", "Info" = "Whois.nic.info", "Name" = "Whois.nic.name", "NET" = "Whois.internic.net", "gov" = "whois.nic.gov", "Edu" = "whois.internic.net", "Mil" = "rs.internic.net", "int" = "whois.iana.org", "AC" = "whois.nic.ac", "AE" = "whois.uaenic.ae", "At" = "whois.ripe.net", "Au" = "whois.aunic.net", "Be" = "whois.dns.be", "BG" = "whois.ripe.net", "BR" = "whois.registro.br", "BZ" = "whois.belizenic.bz", "Ca" = "whois.cira.ca", "CC" = "whois.nic.cc", "ch" = "whois.nic.ch", "CL" = "whois.nic.cl", "cn" = "whois.cnnic.net.cn", "CZ" = "whois.nic.cz", "De" = "whois.nic.de", "FR" = "whois.nic.fr", "Hu" = "whois.nic.hu", "ie" = "whois.domainregistry.ie", "Il" = "whois.isoc.org.il", "In" = "whois.ncst.ernet.in", "IR" = "whois.nic.ir", "MC" = "Whois.ripe.net", "To" = "whois.tonic.to", "TV" = "whois.tv", "Ru" = "whois.ripn.net", "org" = "whois.pir.org", "Aero" = "Whois.information.aero", "NL" = "whois.domain-registry.nl" ); if (!isset ($servers [$ext])) { Die (' error:no matching NIC server found! '); } $nic _server = $servers [$ext]; $output = "; Connect to WHOIS Server: if ($conn = Fsockopen ($nic _server, 43)) { Fputs ($conn, $domain. " \ r \ n "); while (!feof ($conn)) { $output. = Fgets ($conn, 128); } Fclose ($conn); } else {die (' error:could does connect to '. $nic _server. '!'); } return $output; } Some Example Queries: Print whois_query (' jonasjohn.de '); Print whois_query (' example.com '); Print whois_query (' example.org '); |