PHP Whois Script
Glenn over at SSEO asked for a script to do mass whois lookups.
Use this function:
[code lang="php"]
function getwhois($domain, $tld)
{
require_once("whois.class.php");
$whois = new Whois();
if( !$whois->ValidDomain($domain.'.'.$tld) ){
return 'Sorry, the domain is not valid or not supported.';
}
if( $whois->Lookup($domain.'.'.$tld) )
{
return $whois->GetData(1);
}else{
return 'Sorry, an error occurred.';
}
}
$domain = trim($_REQUEST['domain']);
$dot = strpos($domain, '.');
$sld = substr($domain, 0, $dot);
$tld = substr($domain, $dot+1);
$whois = getwhois($sld, $tld);
echo "
"; echo $whois; echo "
";
[/code]
To call this class.
We’ve added some code to this that checks for whois every 15 seconds + some random increment between 0 and three seconds, as well as a router reset every 10 minutes. If you want that code, let me know.