You will need a bunch of proxies depending on the number of requests you plan to send. You can send about 500 requests per day and IP / proxy without causing problems or detection.
You should read google-rank-checker.squabbel.com article containing a full-featured scraper in PHP. Use this scraper, modify it according to your requirements and add the phpsimplehtmlparser code (another answer) to get general information about the results for keywords.
I suggest using libCURL to access Google itself. You will have more options than using a simpler API, you will not have much fun working with file_frames or similar internal php functions, since Google will block your script soon.
Something like that:
curl_setopt ($ch, CURLOPT_HEADER, 0); curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt ($ch, CURLOPT_RETURNTRANSFER , 1); $curl_proxy = "$IP:$PORT"; curl_setopt($ch, CURLOPT_PROXY, $curl_proxy); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20); curl_setopt($ch, CURLOPT_TIMEOUT, 20); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.0; en; rv:1.9.0.4) Gecko/2009011913 Firefox/3.0.6"); $url = sprintf('http://www.google.com/search?q=%s', $keyword); curl_setopt ($ch, CURLOPT_URL, $url); $htmdata = curl_exec ($ch);
Now just use regex () / substr () / strstr () to grab data from $ htmldata p>
source share