这是我的代码
function doGoogleSearch($searchTerm,$start)
{
$endpoint = 'web';
$key= '...';
$url = "http://ajax.googleapis.com/ajax/services/search/".$endpoint;
$args['q'] = $searchTerm;
$args['v'] = '1.0';
$args['rsz']=8;
//$args['start']=8;
$args['key']="xxx";
$url .= '?'.http_build_query($args, '', '&');
$url.="&start=".$start;
$ch = curl_init()or die("Cannot init");
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//curl_setopt($ch, CURLOPT_REFERER, $referer);
$body = curl_exec($ch)or die("cannot execute");
curl_close($ch);
//decode and return the response
return json_decode($body,1);
}
通过使用这段代码,我得到了大约 64 个谷歌结果。之后我收到了这样的消息:
Array
(
[responseData] =>
[responseDetails] => out of range start
[responseStatus] => 400
)
有什么办法可以得到google的所有结果吗?
伙计们,我终于明白了。2006 年之后,没有任何方法可以从 google 的搜索 api 获得超过 64 个结果。但是仍然有一些服务可以获得大约 1000 个结果,因为他们在 2006 年之前获得了 api 密钥,所以他们仍然享受该服务。
请阅读以下内容:
http://groups.google.com/group/Google-AJAX-Search-API/browse_thread/thread/db6616286ce83ca0# http://groups.google.com/group/Google-AJAX-Search-API/browse_thread/thread/db6616286ce83ca0#
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)