我可以使用谷歌搜索的软件吗?

时间:2011-04-02 17:50:42

标签: php web-services

您好 是否有可在Google网上搜索的API? 我想把国家设置为(IT,US,CA等)并对其进行搜索。

让我知道,谢谢

5 个答案:

答案 0 :(得分:1)

答案 1 :(得分:0)

file_get_contents("http://www.google.com/search?hl=$lang&q=$query")

答案 2 :(得分:0)

http://code.google.com/apis/customsearch/v1/overview.html

我在Google上花了15秒才找到。

注意:如果您计划在一天内使用超过100个查询,则需要为该服务付费。

编辑:应该注意这是为您的网站创建自定义搜索引擎。如果您只是希望它在Google上通过网络进行搜索...那里有小工具。我会假设前者,即使两者都可以在不到一分钟的时间内使用谷歌回答。

答案 3 :(得分:0)

是的。看看http://code.google.com/apis/customsearch/v1/overview.html

  

JSON / Atom自定义搜索API可让您开发网站和程序,以编程方式从Google自定义搜索中检索和显示搜索结果。使用此API,您可以使用RESTful请求以JSON或Atom格式获取搜索结果。

答案 4 :(得分:0)

我建议您使用CURL扩展程序。允许请求和有趣的参数(例如,支持更快的gzip压缩请求):

$lang = 'es'; // Spanish language
$query = 'answer to life, the universe and everything'; // query request

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.google.com/search?hl=$lang&q=$query");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_ENCODING, "gzip,deflate"); // return compress content
$content = curl_exec($ch); // execute request and save in $content var
curl_close($ch); // close and free
相关问题