1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Google results URL list (poor mans style)

Discussion in 'General Programming Chat' started by Boxic, Jan 27, 2009.

  1. Boxic

    Boxic Newbie

    Joined:
    Dec 20, 2008
    Messages:
    7
    Likes Received:
    3
    I spent longer on google trying to find something that would give me a list of urls from the google SERPS than it would have taken just to slap something together:

    I cant post links, but you need to generate your search url using

    h t t p : // google . com / ie

    the /ie part is very important.

    You can append &num=100 to the url to get 100 results, and &start=100 to get results 100+

    Do what you like with it, maybe i will find this on google next time i need it :)

    Code:
    <?
    
    $url = "
    h t t p : / / w w w . google . com/ie?q=QUERY&num=100
    ";
    $google_page = file_get_contents(trim($url));
    
    
    $regex = '/<a title="(.*?)" href=(.*?)>(.*?)<\/a>/i';
    preg_match_all($regex,$google_page,$google_links);
    echo "<pre>";
    //var_dump( $google_links );
    
    foreach ($google_links[2] as $link)
    {
            echo $link . "\r";
    }
    echo "</pre>";
    ?>
    
    
     
    • Thanks Thanks x 2
  2. heiska

    heiska Junior Member

    Joined:
    Dec 5, 2008
    Messages:
    138
    Likes Received:
    169
    Thanks mate, this is something I've been looking for quite a while!
     
  3. sikandar

    sikandar Senior Member

    Joined:
    Mar 15, 2008
    Messages:
    1,097
    Likes Received:
    1,003
    I am looking for a script which can grab the URLs from Google SERPs for any given keyword phrase. Please let me know the details how I can use the above script or if there is any readymade tool which can automate this task.
     
  4. spidykrish

    spidykrish Newbie

    Joined:
    Mar 2, 2015
    Messages:
    7
    Likes Received:
    2
    hey can you please explain how to do it!!!! thanks in advance
     
  5. MrBlue

    MrBlue Senior Member

    Joined:
    Dec 18, 2009
    Messages:
    950
    Likes Received:
    662
    Occupation:
    Web/Bot Developer
    Thanks for the share. Unfortunately, without the integration and use of proxies, this script won't scale.