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

<?
function yandex_pages($url){
$str=file_get_contents("http://yandex.ru/yandsearch?numdoc=10&serverurl={$url}&lr=1");

$str=str_replace("&nbsp;млн","000000",$str);
$str=str_replace("&nbsp;тыс.","000",$str);

preg_match('~<title>[^d]*(d+)[^d]*</title>~',$str,$find);
if(
preg_match("/<title>(.*)ничего не найдено(.*)</title>/s"$str)) {$res=0;} else {$res=$find['1'];}

return 
$res;
}
?>

← назад