0

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?

1 Answer 1

2

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);
?>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.