Free Script To Save You Time Researching Keywords
Most of it is pretty quick and easy, but then it's a bit of a pain when you have to google each phrase to see how many results each are, then type them into a spreadsheet (steps 5 and 6).
So I decided to knock up a script and share it with you.
Here's what you do.
1. Cut and paste the code into a file and save it as 'scrapegoogleresults.php'.
2. Change the $google and $country variables to whatever google/country you want to use. Or, just leave them at the US settings.
3. Load it up onto your server. If you don't have a server you can use xampp (which is a group of programs that allows you to turn your pc into a server).
You only need to do that once. To get your results.
1. Put the phrases into a file called 'search.txt' and save it to the server where scrapegoogleresults.php is. One phrase per line. Make sure there is nothing else on that line except the phrase. With no quotes too.
2. Go to http://yourserver/scrapegoogleresults.php
3. The script will get the results for each phrase and put them in a file called 'results.csv'.
4. Open results.csv up in Excel.
Et Voila! Loads of results in less than a minute, all in a format you can easily use.
I'm thinking about uploading this to my server and allowing you to cut and paste your phrases, and it outputs a csv for you to save. What do you think?
Here's the code for those who want to DIY
<?php $cr = "\n"; $inFile = "search.txt"; $fh = fopen($inFile, 'r'); $searchstringin = fgets($fh); $google = 'http://www.google.com'; $country = 'US'; while ($searchstringin !=""){ $newlines = array("\t","\n","\r","\x20\x20","\0","\x0B"); $searchstringin = str_replace($newlines, "", $searchstringin); $searchstring = str_replace(" ", '+', $searchstringin); $url = $google.'/search?hl=en&q=%22' . $searchstring . '%22&btnG=Search&meta=&gl='.$country; $raw = file_get_contents($url); $content = str_replace($newlines, "", html_entity_decode($raw)); $cr = "\n"; $start = strpos($content,'Results <b>1</b> - <b>10</b> of about'); $start = $start +37; $end = strpos($content,'</b> for ',$start); $results = substr($content,$start,$end-$start); $remove = array("<b>",","); $results = str_replace($remove, "", $results); $text = $searchstringin . "," . $results . $cr; echo $searchstringin,",".$results."<br>"; $out = fopen("results.csv", "a"); if (!$out) { print("Could not append to file"); exit; } fputs ($out,implode,("\n")); fwrite($out,$text); fclose($out); $searchstringin = fgets($fh); sleep(4); } ?>
Mike
*melanie
Mike
~~~~
CBSnooper - Take the hard work out of finding hot Clickbank products.
Tom Brownsword, CISSP®, GCIA, ITILv3
Certified Computer Security Pro
http://ProtectorSupport.com
http://BusinessActionSteps.com
------------------------------
âThey did not know it was impossible so they did itâ
-Samuel Clemens" (As Mark Twain)
âThey did not know it was impossible so they did itâ
-Samuel Clemens" (As Mark Twain)