Scraping Google Local Business Results

Hey zero, Do you have a method to scrape google local business results and see where a listing appears in a) the 7-pack or b) the full listings for certain search terms? WP (from here)

Get Google SERP and preg match local business results with

$page = file_get_contents('http://www.google.com/search?q=new+york+pizza');
 
preg_match_all(
    '@<h4[^>]*class=r[^>]*>\s*<a\s*href="(.*)".*class=l.*title="(.*)".*>@siU',
    $page,
    $matches);
 
print_r($matches[1]); // urls
print_r($matches[2]); // titles

new-york-pizza-google-local-business-results

Then preg match regular listings (I hope regex works) and go through both $matches, local and regular.

HTH

9 thoughts on “Scraping Google Local Business Results”

  1. Scraping local business results would be a good idea if you are doing seo for any company who cares about local business rankings. There could also be other reasons for this. It would be a good way for an seo company to find potential clients.

  2. Interesting code, looking at it, it would seem to need a little bit more before it becomes automated? Just by looking at the first line in the code, it seems to be kinda of manual search inputs at the moment. But I could be wrong… still though… it’s a great start for the person who requested it.

    Till then,

    Jean

  3. What is the importance of scrape google local business results?How does it reflect to your site and Affect to the SEO?Can anyone provide valuable information about the codes?

Leave a Reply

Your email address will not be published. Required fields are marked *