Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Member
    Join Date
    Jan 2004
    Posts
    33

    Default Scripts (php) slow to perform lookups

    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:
    Code:
    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; 
    }
    Thank in advance

  2. #2
    Member
    Join Date
    Jan 2004
    Posts
    33

    Default

    bump thanks
    Last edited by n3tph4t; 06-18-2007 at 04:12 AM.

  3. #3
    Member eNetHosts's Avatar
    Join Date
    Apr 2007
    Posts
    195

    Default

    Quote Originally Posted by n3tph4t View Post
    bump thanks
    Why copy the whole lot of you post? When you just had to post reply "bump" hmm anyway...

    If someone can help they'll find you post a bump won't get you any further
    Our Website: http://www.enethosts.co.uk
    Premium Value Server Management: Click Here
    Our Off Network Support Services: Click Here
    Our Webdesign Services: Click Here
    Our Hosting Services: Click Here
    VPS/VDS Hosting, Super Cheap, Below Competitive Prices and cPanel Virtuozzo: Click Here - You Won't Find A Better Deal!


  4. #4
    Member
    Join Date
    Jan 2004
    Posts
    33

    Default

    Quote Originally Posted by eNetHosts View Post
    Why copy the whole lot of you post? When you just had to post reply "bump" hmm anyway...

    If someone can help they'll find you post a bump won't get you any further
    I wasn't deliberate, I am used to quoting when I post on lots of forums so it was out of habit (now removed).

    I'm not sure what you are trying to say with your second sentence:

    "If someone can help they'll find you post a bump won't get you any further "

    ?!

  5. #5
    Member
    Join Date
    Oct 2005
    Posts
    14

    Default

    Sorry to bump an old post but im experiencing the same problem , did you resolve this ?

Similar Threads & Tags
Similar threads

  1. /scripts/fixwebmail error and webmail slow
    By Secret Agent in forum E-mail Discussions
    Replies: 7
    Last Post: 05-14-2010, 02:02 AM
  2. CGI scripts not sending email, php scripts will
    By BianchiDude in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 11-17-2006, 05:20 AM
  3. cgi/php scripts slow
    By Daemon1 in forum cPanel and WHM Discussions
    Replies: 5
    Last Post: 05-19-2006, 05:04 AM
  4. /scripts/runweblogs user ---- very very slow
    By cosmin in forum cPanel and WHM Discussions
    Replies: 5
    Last Post: 04-03-2005, 01:14 PM
  5. CPanel Server Slow Login/PHP/CPanel Slow, everything is slow
    By Shiekron2 in forum cPanel and WHM Discussions
    Replies: 7
    Last Post: 06-24-2002, 12:26 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube