<?php
extract($_GET);
$data = file_get_contents("http://ajax.googleapis.com/ajax/services/feed/find?v=1.0&q=" . $category );
echo json_decode($data);
?>
这给了我一个错误:可捕获的致命错误:类stdClass的对象无法转换为字符串
答案 0 :(得分: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';
}
?>
来调用它