Harinder
Harinder

Reputation: 1257

Check Index Pages in Google

I want to check status of multiple sites of Index Pages in Google for thst i am trying this script but its not giving correct result

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);
  $result = intval($data->responseData->cursor->estimatedResultCount);
  return $result;
}

echo getGoogleCount('printerdriversdownload.com');

I am getting result 9750 but if i am checking with site:printerdriversdownload.com in google i am getting 67,300

Please help

Upvotes: 1

Views: 487

Answers (1)

KorreyD
KorreyD

Reputation: 1294

unfortunately this appears to be a bug in the API. you may google "estimatedResultCount bug" or similar to find the slew of folks before you who have posted to the google groups forum looking for an answer/fix for this problem.

The closest I've seen of an answer from google on this issue came from here (the question was very similar to yours): https://groups.google.com/forum/#!msg/google-ajax-search-api/eQBLXNCt2jw/gm4oZ05e4KIJ

Answer:

"Unfortunately, the estimated result count is a rough estimate and is not reliable enough to be used for research/exact calculations. It is subject to frequent change as our index changes. Also, there are no plans to change its behavior.

Thanks, Ben Lisbakken"

According to his linked in profile Ben Lisbakken was a senior software engineer for google AJAX APIs from 2009-2011.

Also just a heads up:

on the documentation page for the api you are using it states

"Note: The Google Web Search API has been officially deprecated as of November 1, 2010. It will continue to work as per our deprecation policy, but the number of requests you may make per day will be limited. Therefore, we encourage you to move to Custom Search, which provides an alternative solution."

which pretty much solidifies that there wont be a fix for your estimatedResultCount issue in the future.

Upvotes: 1

Related Questions