Google 2 RSS
On ThreadWatch yesterday there was a thread about rank checkers, and I couldn’t believe that some SEOs don’t use them. We use our own heavy duty mega serp scraper to fully analyse any industry we are working in. Anyway, Graywolf mentioned how he would love a Google RSS or XML feed – I having been waiting for this for a long time, as their SERPs are so dirty it would make things a bit easier. And to only offer 10 results per page in their API is shocking!! Come on Goo, catch up with MSN + Yahoo.
Anyway, I got a bit bored today and knocked up a quick Google2RSS php script for those who are without (being xmas season)
Warning – this is very quick, dirty + crude code (in other words – not the best)
[code lang="php"]
header("Content-type: text/xml\n");
echo google2rss("spam", 10);
function google2rss($query, $numres)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.google.com/search?q=".$query."&num=".$numres."&hl=en&safe=off");
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$html = curl_exec($ch);
curl_close ($ch);
$html = str_replace("\r\n", " ", $html);
$html = str_replace("
", "\n
", $html);
$html = str_replace("
", "
I could not make it working
All I can see running this script is only:
-
-
games – Google Search
http://www.google.com/search?q=games&num=10&hl=en&safe=off
games – Google RSS search results
Mon, 02 Nov 09 23:05:23 +0100
Mike Nott – http://www.nott.org
en
Whan should be done to run this script properly?