hI, I could not get this right. I would like to get the totalResults from this returned json result
full text: http://code.google.com/apis/customsearch/v1/using_rest.html
"request": [
{
"title": "Google Custom Search - flowers",
"totalResults": 10300000,
"searchTerms": "flowers",
}
]
},
i tried this:
$response = file_get_contents('https://www.googleapis.com/customsearch/v1?key=INSERT-YOUR-KEY&cx=013036536707430787589:_pqjad5hr1a&q=flowers&alt=json
');
$json = json_decode($response);
echo "Total Result:".$json->request->totalResults;
but i got nothing. Need help pls. Thanks.
Perhaps try an if(!is_null($json->request->totalResults)) conditional to see if you're even getting a response.
In your post it's not visible all the json. In my tests it works with this:
$json->queries->request[0]->totalResults;