I am running a couple of scripts which need to resolve hostnames as part of their operation.
Initially I had my resolv.conf set up poorly and this meant that even lookups performing ping were slow. I have changed this and these are now much faster.
My scripts however are still slow. I am using sockets for these scripts and so I guess my question is....does PHP(/apache?) use a different list when resolving a hostname.
Either way, can you point me in a direction it may be worth me looking at?
My script is basically:
Thank in advanceCode:function GooglePageRank($url){ $arr = parse_url($url); $url = $arr['host']; $url="info:".$url; $ch=GoogleCSum($url,0xE6359A60); $host="toolbarqueries.google.com"; $hostip=gethostbyname($host); $query ="GET /search?client=navclient-auto&ch=6".$ch."&ie=UTF-8&oe=UTF-8&features=Rank&q=".rawurlencode($url)." HTTP/1.0\r\n"; $query.="Host: $host\r\n"; $rank=-1; $query.="User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n"; $query.="Connection: Close\r\n\r\n"; $fp=fsockopen($hostip,80,$errno,$errstr,30); if ($fp) { fputs($fp,$query); $data=""; while (!feof($fp)) $data.=fgets($fp,4096); fclose($fp); $data=explode("\n",$data); foreach ($data as $line) if (!is_bool(strpos($line,"Rank_1"))) { $rank=explode(":",trim($line)); $rank=$rank[2]; break; } } return $rank; }



LinkBack URL
About LinkBacks
Reply With Quote
thanks





hmm anyway...




