whois查询
<?php
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Expires: now");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
$domain=$_REQUEST['domain'];
$server=$_REQUEST['server'];
$domain3="T";
function bar2($domainb){
if($domainb==""){
return "C1";
}
$domain2=substr($domainb,-3);
switch($domain2){
case "com":
$server="whois.internic.net";
break;
case "net":
$server="whois.internic.net";
break;
case "org":
$server="whois.pir.org";
break;
case "nfo":
$server="whois.afilias.info";
break;
case "biz":
$server="whois.biz";
break;
case ".cc":
$server="whois.nic.cc";
break;
case "edu":
$server="whois.educause.net";
break;
case "mil":
$server="whois.nic.mil";
break;
case "gov":
$server="whois.nic.gov";
break;
case ".uk":
$server="whois.nic.uk";
break;
case ".us":
$server="whois.nic.us";
break;
case "ame":
$server="whois.nic.name";
break;
case "eum":
$server="whois.museum";
break;
case ".su":
$server="whois.ripn.net";
break;
case ".ru":
$server="whois.nic.ru";
break;
case "int":
$server="whois.iana.org";
break;
case ".ws":
$server="whois.worldsite.ws";
break;
case ".kr":
$server="whois.krnic.net";
break;
case ".jp":
$server="whois.nic.ad.jp";
break;
case ".it":
$server="whois.nic.it";
break;
case ".de":
$server="whois.denic.de";
break;
case ".fr":
$server="whois.nic.fr";
break;
case ".ca":
$server="whois.cira.ca";
break;
case ".cn":
$server="whois.cnnic.net.cn";
break;
case ".tw":
$server="whois.twnic.net.tw";
break;
case ".hk":
$server="whois.hkdnr.net.hk";
break;
case ".au":
$server="whois.aunic.net";
break;
case ".ac":
$server="whois.nic.ac";
break;
default:
$server="NA&".$domainb."&".$domain2;
}
return $server;
}
if($server==""){
$server=bar2("$domain");
if(strstr($server,"NA")){
$domain3="F";
}
}
print($server."\r\n\r\n<br/><br/>");
if($domain3=="T"){
$fp = fsockopen($server, 43, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
$out = "$domain\r\n";
$out .= "Connection: Close\r\n\r\n";
fputs($fp, $out);
while (!feof($fp)) {
echo nl2br(fgets($fp, 128));
}
fclose($fp);
}
}
print("\r\n\r\n<br/><br/>");
print(date("D M j G:i:s T Y").".\r\n<br/>");
print("0-soft.com whois query system.\r\n<br/>");
print("Jason Lee, mcse86@hotmail.co.uk\r\n\r\n<br/><br/>");
print("for more info, see rfc2958.\r\n\r\n<br/><br/>");
//print("========================================\r\n\r\n<br/><br/>");
?>
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Expires: now");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
$domain=$_REQUEST['domain'];
$server=$_REQUEST['server'];
$domain3="T";
function bar2($domainb){
if($domainb==""){
return "C1";
}
$domain2=substr($domainb,-3);
switch($domain2){
case "com":
$server="whois.internic.net";
break;
case "net":
$server="whois.internic.net";
break;
case "org":
$server="whois.pir.org";
break;
case "nfo":
$server="whois.afilias.info";
break;
case "biz":
$server="whois.biz";
break;
case ".cc":
$server="whois.nic.cc";
break;
case "edu":
$server="whois.educause.net";
break;
case "mil":
$server="whois.nic.mil";
break;
case "gov":
$server="whois.nic.gov";
break;
case ".uk":
$server="whois.nic.uk";
break;
case ".us":
$server="whois.nic.us";
break;
case "ame":
$server="whois.nic.name";
break;
case "eum":
$server="whois.museum";
break;
case ".su":
$server="whois.ripn.net";
break;
case ".ru":
$server="whois.nic.ru";
break;
case "int":
$server="whois.iana.org";
break;
case ".ws":
$server="whois.worldsite.ws";
break;
case ".kr":
$server="whois.krnic.net";
break;
case ".jp":
$server="whois.nic.ad.jp";
break;
case ".it":
$server="whois.nic.it";
break;
case ".de":
$server="whois.denic.de";
break;
case ".fr":
$server="whois.nic.fr";
break;
case ".ca":
$server="whois.cira.ca";
break;
case ".cn":
$server="whois.cnnic.net.cn";
break;
case ".tw":
$server="whois.twnic.net.tw";
break;
case ".hk":
$server="whois.hkdnr.net.hk";
break;
case ".au":
$server="whois.aunic.net";
break;
case ".ac":
$server="whois.nic.ac";
break;
default:
$server="NA&".$domainb."&".$domain2;
}
return $server;
}
if($server==""){
$server=bar2("$domain");
if(strstr($server,"NA")){
$domain3="F";
}
}
print($server."\r\n\r\n<br/><br/>");
if($domain3=="T"){
$fp = fsockopen($server, 43, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
$out = "$domain\r\n";
$out .= "Connection: Close\r\n\r\n";
fputs($fp, $out);
while (!feof($fp)) {
echo nl2br(fgets($fp, 128));
}
fclose($fp);
}
}
print("\r\n\r\n<br/><br/>");
print(date("D M j G:i:s T Y").".\r\n<br/>");
print("0-soft.com whois query system.\r\n<br/>");
print("Jason Lee, mcse86@hotmail.co.uk\r\n\r\n<br/><br/>");
print("for more info, see rfc2958.\r\n\r\n<br/><br/>");
//print("========================================\r\n\r\n<br/><br/>");
?>
原贴地址:
http://community.csdn.net/Expert/topic/4020/4020077.xml?temp=.3690454