In the previous PHP host domain name program used in a WHOIS check code, used to determine whether the queried domain name is registered, the function contains most of the domain name suffix, will be based on the suffix of different connections to different query servers, previously able to use, time relations, I do not now test those query Web site can still be used, if not, you need to find information on your own, to see what the current Web site is.
01
02function Whois_query ($domain) {
$domain = Strtolower (Trim ($domain));
$domain = preg_replace ('/^http:///i ', ', $domain);
$domain = preg_replace ('/^www./i ', ', $domain);
$domain = explode ('/', $domain);
Modified $domain = Trim ($domain [0]);
08//Cutting domain name
$_domain = Explode ('. ', $domain);
$lst = count ($_domain)-1;
One $ext = $_domain[$lst];
12//Define the query server address of the connection required by different domain name suffixes
$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",
Notoginseng "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"
53);
The IF (!isset ($servers [$ext])) {
Die (' Error: no matching server found! ');
56}
$nic _server = $servers [$ext];
$output = ';
59//Connection Domain Name server:
if ($conn = Fsockopen ($nic _server, 43)) {
Fputs ($conn, $domain. " RN ");
The while (!feof ($conn)) {
$output. = Fgets ($conn, 128);
64}
Fclose ($conn);
66}
-Else {die (' Error: Cannot connect to: '. $nic _server. '!'); }
return $output;
69}
70?>
After a function call, the result is returned directly.