= 3) { $sDomain = substr($sDomain,4); } $sExt = strtolower($aDom[count($aDom) - 1]); $aNic = array('ar','im','as','am','au','bt','bg','cl','cc','cg','bi','rw','zr','cr','cz','dk','ec','fo','gl','fr','de','ir', 'it','jo','my','mx','ni','nl','nu','pk','pl','ru','sg','sk','es','tw','th','to','tm','uk','ua','co','ch','li'); $aUS = array('com','net','org','info','biz'); $aRipe = array('il','gr','gg','je'); $aAPNic = array(); $aAUNic = array(); $aJPNic = array('jp'); if($sExt != "") { $iErrorLevel = 0; if(in_array($sExt, $aNic)) { $sServer = "whois.nic." . $sExt; } elseif(in_array($sExt, $aUS)) { $sServer = "whois.networksolutions.com"; } elseif(in_array($sExt, $aRipe)) { $sServer = "whois.ripe.net"; } elseif(in_array($sExt, $aAPNic)) { $sServer = "whois.apnic.net"; } elseif(in_array($sExt, $aAUNic)) { $sServer = "whois.ausregistry.net.au"; } elseif(in_array($sExt, $aJPNic)) { $sServer = "whois.nic.ad.jp"; $sDomain = $sDomain . "/e"; } elseif($sExt == "se") { $sServer = "whois.nic-se.se"; } elseif($sExt == "lu") { $sServer = "whois.restena.lu"; } else { $iErrorLevel = 2; } } else { $iErrorLevel = 1; } if (!empty($sDomain) && $iErrorLevel == 0) { $fp = fsockopen("$sServer", 43, &$errno, &$errstr, 30); if(!$fp) { $output = "$errstr ($errno)
n"; } else { fputs($fp,"$sDomainn"); while(!feof($fp)) { $sOutput = $sOutput . ereg_replace("t", " ", fgets($fp,128)) . "
n"; } fclose($fp); } } elseif($iErrorLevel == 2) { $sOutput = "Error $sExt for domain $sDomain is not a recognised extension
n"; } return $sOutput; } /* Basically you're free to use this script and modify it for your site under the following restrictions: 1, That you email me if you find it useful and tell me where you're using it (just to see if it's used at all really) 2, You email me any modifications so that I can include them if they're of value Takes the domain extension and checks to see which domain server it needs to go and find. Once it's found it it makes a connection to port 43 and sends the domain to look up. The returned data is the output from the server. For domains where the server is of the form whois.nic.extension I have created a list to simplify matters. The other lists are for servers that handle multiple domains. Where possible I have used the authoritative registry holder but where I had difficulty I used the region server instead. The part where the server connection takes place was heavily influenced by a script written by fiera@fiera.net so thanks to him/her. */ ?>