Codice PHP:
<?php
/*
Includo le classi
*/
include_once('errori.php') ;
include_once('principale.php') ;
include_once('oggetti.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') ;
$coukObj = new WHOISdb('whois.nic.uk', 'no match') ;
$orgukObj = 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') ;
$comuaObj = new WHOISdb('whois.net.ua', 'No entries found') ;
$ruObj = new WHOISdb('whois.ripn.ru', 'no entries found') ;
$comruObj = new WHOISdb('whois.ripn.ru', 'no entries found') ;
$netruObj = new WHOISdb('whois.ripn.ru', 'no entries found') ;
$orgruObj = 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' => $coukObj,
'org.uk' => $orgukObj,
'de' => $deObj,
'dk' => $dkObj,
'fr' => $frObj,
'ua' => $uaObj,
'com.ua' => $comuaObj,
'ru' => $ruObj,
'com.ru' => $comruObj,
'net.ru' => $netruObj,
'org.ru' => $orgruObj,
'tv' => $tvObj,
'ws' => $wsObj,
);
/*
dati provenienti da form
*/
$domain = $_REQUEST[dominio];
$tld = $_REQUEST[tld];
if(!$resultObj = $tldList[ $tld ]->checkDomain($domain, $tld)){
die('&error= Si sono verificati dei problemi, ci scusiamo per il disservizio') ;
/*
debug
*/
$tldList[ $tld ]->getErrors() ;
}
elseif( $resultObj->isAvailable() ){
echo('&mess='.$resultObj->getDomain().' è disponibile') ;
}
else{
echo('&mess='.$resultObj->getDomain().' non è disponibile') ;
echo('&mess1= '.$resultObj->getInfo().'') ;
}
?>