0

<?php extract($_GET); $data = file_get_contents("http://ajax.googleapis.com/ajax/services/feed/find?v=1.0&q=" . $category ); echo json_decode($data); ?> This is giving me an error : Catchable fatal error: Object of class stdClass could not be converted to string

4

1 回答 1

0

尝试这个:

<?php
$data = file_get_contents("http://ajax.googleapis.com/ajax/services/feed/find?v=1.0&q=".$_GET["query"]);
$object = json_decode($data);

if(count($object->responseData->entries)>0){
    foreach($object->responseData->entries as $entry){
        echo '<pre>';
        print_r($entry);
        echo '</pre>';
    }
}else{
    echo 'no data';
}
?>

你必须通过http://example.com/thisfile.php?query=my_text调用它

于 2014-12-11T17:53:36.790 回答