내가 성공적으로 사용했습니다
<?php
$query = "Steve Jobs";
$api_url = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&&rsz=large&q=".$query;
$body = file_get_contents($api_url);
$json = json_decode($body);
for($x=0;$x<count($json->responseData->results);$x++)
{
echo "<b>Result ".($x+1)."</b>";
echo "<br>URL: ";
echo $json->responseData->results[$x]->url;
echo "<br>VisibleURL: ";
echo $json->responseData->results[$x]->visibleUrl;
echo "<br>Title: ";
echo $json->responseData->results[$x]->title;
echo "<br>Content: ";
echo $json->responseData->results[$x]->content;
echo "<br><br>";
}
,
응용 프로그램/도우미/google_helper. PHP
<?php
function google_search($query)
{
$api_url = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&&rsz=large&q=".$query;
$body = file_get_contents($api_url);
return json_decode($body);
}
다음 코드를 사용해 보았습니다. $ search = $ this-> google-> web ('cat', array ('filter'=> 'company')); –