Как подсчитать количество индексированных страниц Google через PHP

Привет, я пытаюсь создать скрипт, который должен получить счет со всеми проиндексированными страницами из Google. Только общее количество страниц (результаты с сайта: $ domain)

Я нашел этот скрипт:

function getGoogleCount($domain) { $content = file_get_contents('http://ajax.googleapis.com/ajax/services/search/web?v=1.0&filter=0&q=site:' . urlencode($domain)); $data = json_decode($content); return intval($data->responseData->cursor->estimatedResultCount); } 

Но этот API старый и дает разные значения, так же как и любой другой способ подсчета индексированных страниц?

благодаря

Попробуй это:

 <?php function getpageindexed($name){ $weburl="http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=site:".$name."&filter=0"; $ch=curl_init(); curl_setopt($ch, CURLOPT_URL, $weburl); curl_setopt($ch, CURLOPT_USERAGENT,$_SERVER['HTTP_USER_AGENT']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt ($ch, CURLOPT_HEADER, 0); curl_setopt ($ch, CURLOPT_NOBODY, 0); curl_setopt($ch, CURLOPT_TIMEOUT, 30); $json = curl_exec($ch); curl_close($ch); $data=json_decode($json,true); if($data['responseStatus']==200) return $data['responseData']['cursor']['resultCount']; else return false; } $name="domainname.com"; //your domain name echo getpageindexed($name); //get indexed page ?>