View Single Post
Old 04-07-2009, 09:30 AM   #1 (permalink)
BackBanana
Senior Member
 
BackBanana's Avatar
 
Join Date: Sep 2008
Location: shithole england
Posts: 333
iTrader: 2 / 100%
BackBanana has a reputation beyond reputeBackBanana has a reputation beyond reputeBackBanana has a reputation beyond reputeBackBanana has a reputation beyond reputeBackBanana has a reputation beyond reputeBackBanana has a reputation beyond reputeBackBanana has a reputation beyond reputeBackBanana has a reputation beyond reputeBackBanana has a reputation beyond reputeBackBanana has a reputation beyond reputeBackBanana has a reputation beyond repute
Tools google suggest scraper - free php script

saw someone selling something similar just now, so spent 5 minutes knocking something up. Save yourself 29$

php script, shouldnt need anything special and should work on php4 for those who are retro lol.

should also work on crippled hosts as long as you can use fsockopen.

simply outputs a lists, shouldnt be hard to generate xml or whatever, but this should get you started.

Code:
function text_between($start,$end,$string) {
  if ($start != '') {$temp = explode($start,$string,2);} else {$temp = array('',$string);}
  $temp = explode($end,$temp[1],2);
  return $temp[0];
}
function gsscrape($keyword) {
  $keyword=str_replace(" ","+",$keyword);
  global $kw;
  $data=file_get_contents('http://clients1.google.com/complete/search?hl=en&gl=uk&q='.$keyword);
  $data=explode('[',$data,3);
  $data=explode('],[',$data[2]);
  foreach($data as $temp) {
  $kw[]= text_between('"','"',$temp);
  }
}
#simple to use, just use yourscriptname.php?keywords
if ($_SERVER['QUERY_STRING']!='') {
  gsscrape($_SERVER['QUERY_STRING']);
  foreach ($kw as $keyword) {
  gsscrape($keyword);
  }
}

#all results are in array $kw...
print_r($kw);
cheers
BackBanana is offline