Hello guys i need your help. I am tearing my hair out here, can somebody please have a look at this code for me, I have tried to runn it many times but its not returning any data, i don't know what's wrong

<script><?
if ($dom){
include "/whois.inc";
$whoisresult = lookup($dom);
$isavail = $whoisresult[0]; // Contains "1" is it's available, blank if it's registered
$whotext = $whoisresult[1]; // Contains the full response from the server.
#The PRE tags are there to display the results in web browsers without replacing n with <br>..its just cleaner and quicker that way. 😉
if ($isavail=="1"){
echo "<strong>This domain is available!</strong>";
}
else
{
echo "<strong>This domain has been registered.</strong>";
}
echo "<pre>".$whotext."</pre>";
}
?></script>

whois.inc as show below

<?
function get_whois_info($domain){
$whoisservers=array(
array("ac","whois.nic.ac","No match"),
array("ac.cn","whois.cnnic.net.cn","No entries found"),
array("ac.jp","whois.nic.ad.jp","No match"),
array("ac.uk","whois.ja.net","no entries"),
array("ad.jp","whois.nic.ad.jp","No match"),
array("adm.br","whois.nic.br","No match"),
array("adv.br","whois.nic.br","No match"),
array("aero","whois.information.aero","is available"),
array("ag","whois.nic.ag","does not exist"),
array("agr.br","whois.nic.br","No match"),
array("ah.cn","whois.cnnic.net.cn","No entries found"),
array("al","whois.ripe.net","No entries found"),
array("am.br","whois.nic.br","No match"),
array("arq.br","whois.nic.br","No match"),
array("at","whois.nic.at","nothing found"),
array("au","whois.aunic.net","No Data Found"),
array("art.br","whois.nic.br","No match"),
array("as","whois.nic.as","Domain Not Found"),
array("asn.au","whois.aunic.net","No Data Found"),
array("ato.br","whois.nic.br","No match"),
array("be","whois.geektools.com","No such domain"),
array("bg","whois.digsys.bg","does not exist"),
array("bio.br","whois.nic.br","No match"),
array("biz","whois.biz","Not found"),
array("bj.cn","whois.cnnic.net.cn","No entries found"),
array("bmd.br","whois.nic.br","No match"),
array("br","whois.registro.br","No match"),
array("ca","whois.cira.ca","AVAIL"),
array("cc","whois.nic.cc","No match"),
array("cd","whois.cd","No match"),
array("ch","whois.nic.ch","We do not have an entry"),
array("cim.br","whois.nic.br","No match"),
array("ck","whois.ck-nic.org.ck","No entries found"),
array("cl","whois.nic.cl","no existe"),
array("cn","whois.cnnic.net.cn","no matching record"),
array("cng.br","whois.nic.br","No match"),
array("cnt.br","whois.nic.br","No match"),
array("com","whois.verisign-grs.net","No match"),
array("com.au","whois.aunic.net","No Data Found"),
array("com.br","whois.nic.br","No match"),
array("com.cn","whois.cnnic.net.cn","no matching record"),
array("com.eg","whois.ripe.net","No entries found"),
array("com.hk","whois.hknic.net.hk","No Match for"),
array("com.mx","whois.nic.mx","No Encontradas"),
array("com.ru","whois.ripn.ru","No entries found"),
array("com.tw","whois.twnic.net","NO MATCH TIP"),
array("eti.br","whois.nic.br","No match"),
array("eun.eg","whois.ripe.net","No entries found"),
array("emu.id.au","whois.aunic.net","No Data Found"),
array("gr.jp","whois.nic.ad.jp","No match"),
array("gs","whois.adamsnames.tc","is not registered"),
array("ind.br","whois.nic.br","No match"),
array("imb.br","whois.nic.br","No match"),
array("inf.br","whois.nic.br","No match"),
array("info","whois.afilias.info","Not found"),
array("info.au","whois.aunic.net","No Data Found"),
array("it","whois.nic.it","No entries found"),
array("idv.tw","whois.twnic.net","NO MATCH TIP"),
array("int","whois.iana.org","not found"),
array("is","whois.isnic.is","No entries found"),
array("il","whois.isoc.org.il","No data was found"),
array("jl.cn","whois.cnnic.net.cn","No entries found"),
array("jor.br","whois.nic.br","No match"),
array("plc.uk","whois.nic.uk","No match for"),
array("pp.ru","whois.ripn.ru","No entries found"),
array("ppg.br","whois.nic.br","No match"),
array("pro.br","whois.nic.br","No match"),
array("psi.br","whois.nic.br","No match"),
array("psc.br","whois.nic.br","No match"),
array("pt","whois.ripe.net","No entries found"),
array("qh.cn","whois.cnnic.net.cn","No entries found"),
array("qsl.br","whois.nic.br","No match"),
array("rec.br","whois.nic.br","No match"),
array("ro","whois.rotld.ro","No entries found"),
array("ru","whois.ripn.ru","No entries found"),
array("sc.cn","whois.cnnic.net.cn","No entries found"),
array("sd.cn","whois.cnnic.net.cn","No entries found"),
array("se","whois.nic-se.se","No data found"),
array("sg","whois.nic.net.sg","NO entry found"),
array("sh","whois.nic.sh","No match for"),
array("sh.cn","whois.cnnic.net.cn","No entries found"),
array("si","whois.arnes.si","No entries found"),
array("sk","whois.ripe.net","no entries found"),
array("slg.br","whois.nic.br","No match"),
array("sm","whois.ripe.net","no entries found"),
array("trd.br","whois.nic.br","No match"),
array("tur.br","whois.nic.br","No match"),
array("tv","whois.tv","MAXCHARS:75"),
array("tv.br","whois.nic.br","No match"),
array("tw","whois.twnic.net","NO MATCH TIP"),
array("tw.cn","whois.cnnic.net.cn","No entries found"),
array("uk","whois.thnic.net","No match for"),
array("us","whois.nic.us","Not found:"),
array("va","whois.ripe.net","No entries found"),
array("vet.br","whois.nic.br","No match"),
array("vg","whois.adamsnames.tc","is not registered"),
array("wattle.id.au","whois.aunic.net","No Data Found"),
array("ws","whois.worldsite.ws","No match for"),
array("xj.cn","whois.cnnic.net.cn","No entries found"),
array("xz.cn","whois.cnnic.net.cn","No entries found"),
array("yn.cn","whois.cnnic.net.cn","No entries found"),
array("zlg.br","whois.nic.br","No match"),
array("zj.cn","whois.cnnic.net.cn","No entries found"),
array("fo","whois.ripe.net","no entries found")
array("com.ng","whois.register.net.ng","No Match")
);
$whocnt = count($whoisservers);
for ($x=0;$x<$whocnt;$x++){
$artld = $whoisservers[$x][0];
$tldlen = intval(0 - strlen($artld));
if (substr($domain, $tldlen) == $artld) {
$out[0] = $whoisservers[$x][1];
$out[1] = $whoisservers[$x][2];
return $out;
}
}
return $out;
}

function lookup($dom){
$whoinf = get_whois_info($dom);
$lusrv = $whoinf[0];
$notfndtxt = $whoinf[1];

    if (!$lusrv) return "";

    $fp = fsockopen($lusrv,43);
    fputs($fp, "$dom\r\n");
    $string="";
    while(!feof($fp)){
            $string.= fgets($fp,128);
    }
    fclose($fp);

    $reg = "/Whois Server: (.*?)\n/i";
    preg_match_all($reg, $string, $matches);
    $secondtry = $matches[1][0];

    if ($secondtry){
            $fp = fsockopen($secondtry,43);
            fputs($fp, "$dom\r\n");
            $string="";
            while(!feof($fp)){
                    $string.=fgets($fp,128);
            }
            fclose($fp);
    }
    if (stristr($string, $notfndtxt)) $data[0] = "1";
    $data[1] = $string;
    return $data;

}
?>
can somebody please help me
thank u

    Write a Reply...