I need to check several hundred websites/pages a day for the presence of a Google index, in fact, I need an imitation of site:something.com. I use Custom Search JSON API `
$search_query = http_build_query(
array(
"key" => $api_key,
"cx" => $search_id,
"q" => "site:".$link,
"num" => "10",
"safe" => "off"
)
);
$json = file_get_contents("https://www.googleapis.com/customsearch/v1?" . $search_query);
$data = json_decode($json, true);
`
and often in the response it shows that there are no results, although the site is in the index. Checked "handles" through Google itself.
What could be the problem/error?
if you send the query "q" => "site:mysite.com" through the script, then there are no results in the response (variable and items in the response), but if site:mysite.com is entered in the search string, then the site is found.
expected 1 result but API returned 0 results
sleep(1);between the requests.