[Quote=引用楼主 godho 的回复:]
问题: 我想使用google api 向google发送普通查询请求例如“刘翔” 然后拿到网页搜索链接就可以。但是google api 很多该使用哪个? 有没有Java版的API 可以直接用的,推荐一下 谢谢!
[/Quote]
我的代码如下
================================================================================
<script language="Javascript" type="text/javascript">
//<![CDATA[
google.load("search", "1");
function searchComplete(searchControl, searcher) {
//返回所有64个结果怎么处理?????????
for (var i=0; i < searcher.results.length; i++) {
// Do whatever you want with the results
var result = searcher.results[i];
alert(result.title);
}
}
function OnLoad() {
// Create a search control
var searchControl = new google.search.SearchControl();
// Add in a full set of searchers
var localSearch = new google.search.LocalSearch();
//searchControl.addSearcher(localSearch);
searchControl.addSearcher(new google.search.WebSearch());
//searchControl.addSearcher(new google.search.VideoSearch());
//searchControl.addSearcher(new google.search.BlogSearch());
// Set the Local Search center point
//localSearch.setCenterPoint("New York, NY");
localSearch.setCenterPoint("Hong Kong, HK");
// Tell the searcher to draw itself and tell it where to attach
searchControl.draw(document.getElementById("searchcontrol"));