Google
Result Scraper
Search for $s";
$s = urlencode($s);
$data = my_fetch("http://www.google.com/search?hl=en&q=" . $s . "&btnG=Google+Search");
//strip off HTML
$data = strip_tags($data);
//now $data only has text NO HTML
//these have to found 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";
}
else
{
?>
by Learning
Computer Programming