Число страниц в индексе Google:

<?
function google_pages($url){

$ch curl_init();
curl_setopt($chCURLOPT_URL"http://www.google.com/search?&q=site:{$url}&hl=en%5C");
curl_setopt($chCURLOPT_HEADER0);
curl_setopt($chCURLOPT_REFERER"http://www.google.com/");
curl_setopt($chCURLOPT_USERAGENT"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5");
curl_setopt($chCURLOPT_RETURNTRANSFER1);
$str=curl_exec($ch);
curl_close($ch);

if(!
preg_match("/<div id=resultStats>About (.*) results<nobr>/s"$str,$find)) preg_match("/<div id=resultStats>(.*) result(.*)<nobr>/s"$str,$find);

if(
preg_match("/did not match any documents/s"$str)){$res=0;} else {$res=trim($find['1']);}

return 
$res;
}
?>

← назад