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.
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.
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 Custom Search API 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.