Previously in the PHP host domain name program used by a WHOIS check code to determine whether the domain name being queried is registered, the function includes most of the domain name suffix, will be based on the suffix of the different connections to different query server, previously can use, time relationship, I am not currently testing those query URLs are still available, 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);
$domain = Trim ($domain [0]);
08//Cut domain name
$_domain = Explode ('. ', $domain);
Ten $lst = count ($_domain)-1;
One $ext = $_domain[$lst];
12//Define the address of the query server to which the different domain suffixes need to connect
$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);
if (!isset ($servers [$ext])) {
The Die (' Error: no matching server found! ');
56}
$nic _server = $servers [$ext];
$output = ";
59//Connect to the domain name server:
if ($conn = Fsockopen ($nic _server, 43)) {
Fputs ($conn, $domain. " \ r \ n ");
while (!feof ($conn)) {
$output. = Fgets ($conn, 128);
64}
Fclose ($conn);
66}
The else {die (' Error: Cannot connect to: '. $nic _server. '!'); }
$output of the return;
69}
70?>
After the function is called, the result is returned directly.
http://www.bkjia.com/PHPjc/765435.html www.bkjia.com true http://www.bkjia.com/PHPjc/765435.html techarticle previously in the PHP host domain name program used by a WHOIS check code to determine whether the domain name queried is registered, the function includes most of the domain name suffix, will be based on the suffix of the not ...