|
zt from http://www.chinajavaworld.com
Caution:需要google的公钥的。
[PHP]
import java.io.*;
import com.google.soap.search.*; // 这是 googleapi.jar
public class SearchGoogle
{
public static void main(String[] args)
{
if (args.length != 1)
{
System.err.println("Usage: java SearchGoogle LicenseKey 查询字符串 ");
System.exit(1);
}
String clientKey ="your public key";
String queryString = args[0];
System.out.println(" 查询字符串 = " + queryString);
// 产生查找对象,设定输出编码 (big5)
GoogleSearch s = new GoogleSearch();
s.setKey(clientKey);
//s.setOutputEncoding("big5");
s.setProxyHost("202.119.24.35");
s.setProxyPort(8080);
s.setProxyUserName("name");
s.setProxyPassword("password");
try
{
s.setQueryString(queryString);
GoogleSearchResult r = s.doSearch();
System.out.println(" 查找结果 :");
System.out.println("======================");
System.out.println(r.toString());
}
catch (com.google.soap.search.GoogleSearchFault e)
{
System.out.println(" 查找失败 ");
}
}
}
[/PHP]
E:\temp>java SearchGoogle 信息检索
查询字符串 = 信息检索
查找结果 :
======================
{
TM = 0.212145
Q = "信息检索"
CT = ""
TT = ""
CATs =
{
<EMPTY>
}
Start Index = 1
End Index = 10
Estimated Total Results Number = 47200
Document Filtering = true
Estimate Correct = false
Rs =
{
[
URL = "http://www.enviroinfo.org.cn/"
Title = ""
Snippet = ""
Directory Category = {SE="", FVN=""}
Directory Title = ""
Summary = ""
Cached Size = ""
Related information present = true
Host Name = ""
],
[
URL = "http://www.patent.com.cn/"
Title = "中国专利信息网--China Patent Searching Information"
Snippet = ""
Directory Category = {SE="GB2312", FVN="Top/World/Chinese_Simplified/地区/亚洲
/中国/商业与经济"}
Directory Title = "中国专利信息网"
Summary = "集专利检索、专利知识、专利法律法规、项目推广、高技术传播、广告服务
等功..."
Cached Size = "3k"
Related information present = true
Host Name = ""
],
[
URL = "http://www.yippee.com.cn/"
Title = "新司南New Yippee!-朝鲜迷搜索引擎Korea Fan Search Engine"
Snippet = "朝鲜迷搜索引擎. 登录 中文英文 日文 朝文 加入<br> 收藏夹 捉死链. 中
朝网[武汉市朝鲜迷工作室] 镜<br> 像. <b>...</b> "
Directory Category = {SE="", FVN=""}
Directory Title = ""
Summary = ""
Cached Size = "18k"
Related information present = true
Host Name = ""
],
[
URL = "http://www.sipo.gov.cn/sipo/zljs/default.htm"
Title = "专利检索"
Snippet = "全部专利 发明专利 实用新型 外观设计 帮 助 <b>...</b> "
Directory Category = {SE="", FVN=""}
Directory Title = ""
Summary = ""
Cached Size = "32k"
Related information present = true
Host Name = ""
],
[
URL = "http://www.medinfofree.com/"
Title = "免费医药<b>信息</b><b>检索</b>"
Snippet = " <b>...</b> 2003.7.2.更新. 来信标明主题否则被删除. 77级校友会 <br>
校园浏览. 版权所有,任意复制 ?免费医药<b>信息</b><b>检</b><br> <b>索</b>. "
Directory Category = {SE="", FVN=""}
Directory Title = ""
Summary = ""
Cached Size = "9k"
Related information present = true
Host Name = ""
],
[
URL = "http://search.hzic.edu.cn/"
Title = ""
Snippet = ""
Directory Category = {SE="", FVN=""}
Directory Title = ""
Summary = ""
Cached Size = ""
Related information present = true
Host Name = ""
],
[
URL = "http://www.qsjournal.com.cn/qs/20030716/GB/20-QS-XXJS.htm"
Title = "当期杂志"
Snippet = " <b>...</b> [文化大观]: 加快湖南文化产业发展. [红旗论坛]: 从抗击<b
r> 非典看社会主义制度的优越性. 人民日报. . <b>信息</b><b>检索</b>. 期<br> 号: <b
>...</b> "
Directory Category = {SE="", FVN=""}
Directory Title = ""
Summary = ""
Cached Size = "11k"
Related information present = true
Host Name = ""
],
[
URL = "http://www.qsjournal.com.cn/qs/20030701/GB/18-QS-XXJS.htm"
Title = "当期杂志"
Snippet = " <b>...</b> [科教天地]: 大力发展循环经济. 人民日报. . <b>信息</b><
b>检索</b>. 期 号:<br> 文章标题: 文章内容: 作 者: 栏 目: 日 期: 从 至 (格式:yyy
ymmdd). <b>...</b> "
Directory Category = {SE="", FVN=""}
Directory Title = ""
Summary = ""
Cached Size = "11k"
Related information present = true
Host Name = "www.qsjournal.com.cn"
],
[
URL = "http://www.bufotanine.com/search/"
Title = "搜索引擎:中国癌症信息库"
Snippet = "抗癌新药 多媒体频道 乳腺癌专题 专业资源 <b>信息</b><b>检索</b> <br>
癌症预防 科学治癌 健康杂志 癌症SOS, 将本页推荐给好<br> 友. <b>...</b> "
Directory Category = {SE="", FVN=""}
Directory Title = ""
Summary = ""
Cached Size = "11k"
Related information present = true
Host Name = ""
],
[
URL = "http://www.newone.com.cn/search.jsp"
Title = "Newone Search"
Snippet = "预约开户, 网上招聘, <b>信息</b><b>检索</b>, 开放式基金交易, 邮件咨
询,<br> English, 牛网营业厅, 首页. 交易. 新闻. 市场. 研究. 产品. 社<br> 区. 我们
. <b>...</b> "
Directory Category = {SE="", FVN=""}
Directory Title = ""
Summary = ""
Cached Size = "21k"
Related information present = true
Host Name = ""
]
}
} |
|