Codice PHP:
Definisco alcuni oggetti WHOISdb precisando per ognuno il server e la stringa che indica la disponibilità del dominio.
Aggiungi gli altri che ti interessano.
*/
$euObj = new WHOISdb('whois.eu', 'free') ;
$itnicObj = new WHOISdb('whois.nic.it', 'available') ;
$internicObj = new WHOISdb('whois.internic.net', 'no match for') ;
$orgObj = new WHOISdb('whois.pir.org', 'not found') ;
$bizObj = new WHOISdb('whois.nic.biz', 'not found') ;
$infoObj = new WHOISdb('whois.afilias.info', 'not found') ;
/*$nameObj = new WHOISdb('whois.usp.ac.fj', 'was not found') ;*/
$mobiObj = new WHOISdb('whois.afilias.info', 'not found') ;
$atObj = new WHOISdb('whois.aco.net', 'nothing found') ;
$ccObj = new WHOISdb('whois.nic.cc', 'no match') ;
$chObj = new WHOISdb('whois.nic.ch', 'we do not have an entry') ;
$usObj = new WHOISdb('whois.nic.us', 'not found') ;
/*$co.ukObj = new WHOISdb('whois.nic.uk', 'no match') ;*/
$org.ukObj = new WHOISdb('whois.nic.uk', 'no match') ;
$deObj = new WHOISdb('whois.denic.de', 'free') ;
$dkObj = new WHOISdb('whois.dk-hostmaster.dk', 'no entries') ;
$frObj = new WHOISdb('whois.nic.fr', 'no entries') ;
$uaObj = new WHOISdb('whois.net.ua', 'No entries found') ;
/*$com.uaObj = new WHOISdb('whois.net.ua', 'No entries found') ;*/
$ruObj = new WHOISdb('whois.ripn.ru', 'no entries found') ;
/*$com.ruObj = new WHOISdb('whois.ripn.ru', 'no entries found') ;
$net.ruObj = new WHOISdb('whois.ripn.ru', 'no entries found') ;
$org.ruObj = new WHOISdb('whois.ripn.ru', 'no entries found') ;*/
$tvObj = new WHOISdb('whois.[url]www.tv[/url]', 'available') ;
$wsObj = new WHOISdb('whois.worldsite.ws', 'no match') ;
/*
Array che associa i TLD al corretto WHOIS database
*/
$tldList = array(
'eu' => $euObj,
'it' => $itnicObj,
'com' => $internicObj,
'net' => $internicObj,
'org' => $orgObj,
'biz' => $bizObj,
'info' => $infoObj,
'name' => $nameObj,
'mobi' => $mobiObj,
'at' => $atObj,
'cc' => $ccObj,
'ch' => $chObj,
'us' => $usObj,
'co.uk' => $co.ukObj,
'org.uk' => $org.ukObj,
'de' => $deObj,
'dk' => $dkObj,
'fr' => $frObj,
'ua' => $uaObj,
'com.ua' => $com.uaObj,
'ru' => $ruObj,
'com.ru' => $com.ruObj,
'net.ru' => $net.ruObj,
'org.ru' => $org.ruObj,
'tv' => $tvObj,
'ws' => $wsObj,
);
/*
dati provenienti da form
*/
$domain = $_REQUEST[dominio];
$tld = $_REQUEST[tld];
if(!$resultObj = $tldList[ $tld ]->checkDomain($domain, $tld)){
die('Si sono verificati dei problemi, ci scusiamo per il disservizio') ;
/*
debug
*/
$tldList[ $tld ]->getErrors() ;
}
elseif( $resultObj->isAvailable() ){
echo(' [b]&mess='.$resultObj->getDomain().' [/b]è disponibile') ;
}
else{
echo('[b]&mess='.$resultObj->getDomain().'[/b] non è disponibile
') ;
echo('[b]&mess1= Ecco i dettagli [/b]
<pre>'.$resultObj->getInfo().'</pre>') ;
}