I have the following file: https://ajax.googleapis.com/ajax/services/search/images?v=1.0&q=mandarin
The following code: http://plnkr.co/edit/XiUOazUiIPQgN4dePXhI
Gets the images from the file and works great.
When I turn it to search the web (https://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=mandarin) I want to get the url and content "tags" from the code that's provided. Can anyone help with with my code?
Try this:
<?php
$json=file_get_contents("http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=mandarin");
$json=json_decode($json,true);
$data=array();
foreach ($json['responseData']['results'] as $results) {
$data[]=array("url"=>$results['url'],"content"=>$results['content']);
}
print_r($data);
?>