Google
Result Scraper

Search for $s

"; $s=urlencode($s); $main_data=file_get_contents("http://www.google.com/search?hl=en&q=".$s."&btnG=Google+Search"); //strip off HTML $data=strip_tags($main_data); //now $data only has text NO HTML //these have to ound out in the fetched data $find='Results 1 - 10 of about '; $find2=' for'; //have text beginning from $find $data=strstr($data,$find); //find position of $find2 //there might be many occurence //but it'd give position of the first one, //which is what we want, anyway $pos=strpos($data,$find2); //take substring out, which'd be the number we want $search_number=substr($data,strlen($find), $pos-strlen($find)); echo "Pages Indexed: $search_number"; //********S E C O N D P A R T******* //Find related searches echo "

Related Keywords

"; //these have to found out in the fetched data $find='

Searches related to:'; $find2=''; $find3=' (ordered list) echo "
    "; foreach($keywords as $keyword) { if($keyword!='' && $keyword!=' ') echo "
  1. $keyword
  2. "; } echo "
"; } else { ?>

 

 

 

 

by Learning Computer Programming