Using PHP to get number of google search results for strings?


I want to run a PHP script that takes a list of strings, google searches them, and then returns to me (so I can insert into a database, write to a file, whatever) the number of search results.

Is there a way to use a Google API to do this programatically from PHP? Any other methods?

Thanks for any pointers.


The most straight forward way is to simply use contents of the websearch.

foreach($list_of_strings as $string) { $result_in_html = file_get_contents("http://www.google.com/search?q=$string"); //parse the html however you see fit }

However, a <a href="http://code.google.com/apis/customsearch/v1/overview.html" rel="nofollow">Custom Search API</a> does exist.

With the Custom Search API, you have to create an app to receive an authorized API key. With that key, you get 100 free queries per day, and can get results in both JSON and ATOM formats.


No, and if you use cURL to do this from your website, be prepared to get blacklisted by Google rather quickly as this is strictly against their TOS.


  • UIActionSheet orientation
  • Logging to remote asp.net Web Page
  • iPhone set interfaceorientation programmatically
  • Finding the number of elements less than or equal to k in a multiset
  • eC (Ecere) how to not worry about private data fields of a class
  • c# bind winforms chart to list of objects
  • Dump Chrome dev console to text file?
  • including Python.h in C++ file CDT
  • Enumerating Controls on a Form
  • Extract All Possible Paths from Expression-Tree and evaluate them to hold TRUE
  • XSLT foreach repeating nodes to flat
  • How can I display the parent menu item's description using Wordpress walkers?
  • Selenium to click on a javascript button corresponding to a text
  • List images(01.png) and descriptions(01.txt) from directory
  • MySQL Order by column = x, column asc?
  • Is playing sound in Javascript performance heavy?
  • How can I enlarge video fullscreen without the affected interface project in as3?
  • How to define and use opencv mat of user type
  • iOS: Detect app start via notification press
  • How to attach a node.js readable stream to a Sendgrid email?
  • Record samples being played with OpenAL
  • D3 nodes and links from JSON with nested arrays of children
  • Google Custom Search with transparent background
  • Seeking advice on Jetty HttpClient Hang
  • Insert into database using onclick function
  • What is Eclipse's Declaration View used for?
  • Azure Cloud Service Web Role web pages do not load
  • swift auto completion not working in Xcode6-Beta
  • Finding past revisions of files in StarTeam w/ .NET SDK / C#
  • Knitr HTML Loop - Some HTML output, some R output
  • Can I make an Android app that runs a web view in Chrome 39?
  • Can a Chrome extension content script make an jQuery AJAX request for an html file that is itself a
  • Hazelcast - OperationTimeoutException
  • Google cloud sdk not working when python points python3
  • RestKit - RKRequestDelegate does not exist
  • Cannot Parse HTML Data Using Android / JSOUP
  • Revoking OAuth Access Token Results in 404 Not Found
  • C# - Getting references of reference
  • using HTMLImports.whenReady not working in chrome
  • Android Heatmap on canvas or ImageView