关于google搜索(100分)

  • 主题发起人 主题发起人 Tianbing2008
  • 开始时间 开始时间
T

Tianbing2008

Unregistered / Unconfirmed
GUEST, unregistred user!
我想在程序中调用google的搜索
该如何做?
例如我想搜索 ‘工具'
在文本框中输入‘工具’,点击确定后要求调出google搜索'工具‘的页面,该如何写?
------------------------------------------------------------------------
查资料该查那类的资料?
具体一点
我不太会查,不知道该查神莫好

 
好像一些大的搜索引擎都有免费代码的
 
但我不知道上哪找
也不知道该怎么用:(
我懂的东西太少了
 
用个WEB页,直接加入它的搜索链接,不就行了
 
用下面这个ASP的子程序生成WHERE条件就可以了,这个程序是我从动网论坛的程序中找的,我只是加了个把全角空格改半角的语句。
用它非常的方便,可以支持空格、OR、AND等条件,慢慢研究吧。祝你好运~~:-)
------------------------------------------------------
public function translate(sourceStr,fieldStr)
rem 处理逻辑表达式的转化问题
dim sourceList
dim resultStr
dim i,j
sourceStr=replace(sourceStr," "," ")
if instr(sourceStr," ")>0 then
dim isOperator
isOperator = true
sourceList=split(sourceStr)
'--------------------------------------------------------
rem Response.Write "num:" & cstr(ubound(sourceList)) & "<br>"
for i = 0 to ubound(sourceList)
rem Response.Write i
Select Case ucase(sourceList(i))
Case "AND","&","和","与"
resultStr=resultStr & " and "
isOperator = true
Case "OR","|","或"
resultStr=resultStr & " or "
isOperator = true
Case "NOT","!","非","!","!"
resultStr=resultStr & " not "
isOperator = true
Case "(","(","("
resultStr=resultStr & " ( "
isOperator = true
Case ")",")",")"
resultStr=resultStr & " ) "
isOperator = true
Case Else
if sourceList(i)<>"" then
if not isOperator then resultStr=resultStr & " and "
if inStr(sourceList(i),"%") > 0 then
resultStr=resultStr&" "&fieldStr& " like '" & replace(sourceList(i),"'","''") & "' "
else
resultStr=resultStr&" "&fieldStr& " like '%" & replace(sourceList(i),"'","''") & "%' "
end if
isOperator=false
End if
End Select
rem Response.write resultStr+"<br>"
next
translate=resultStr
else '单条件
if inStr(sourcestr,"%") > 0 then
translate=" " & fieldStr & " like '" & replace(sourceStr,"'","''") &"' "
else
translate=" " & fieldStr & " like '%" & replace(sourceStr,"'","''") &"%' "
End if
rem 前后各加一个空格,免得连sql时忘了加,而出错。
end if
end function
----------------------------------------------------
 
谢谢
不过你给的代码好象不是我要得啊!
 
http://www.google.com/search?sourceid=navclient&hl=zh-CN&ie=UTF-8&oe=UTF-8&q=%E5%B7%A5%E5%85%B7
把‘工具’转化成UTF-8的%E5%B7%A5%E5%85%B7不就行了?
 
不好意思,没看清题目,如果你只是想引用搜索,可以看看下面这个地址:
http://www.google.com/intl/zh-CN/searchcode.html
 
1.放个TWebBrowser控件WebBrowser1
2.WebBrowser1.Navigate('http://www.google.com/search?q=%E5%B7%A5%E5%85%B7&ie=UTF-8&oe=UTF-8&hl=zh-CN&lr=');
 
谢谢各位!
我再看看。
 
多人接受答案了。
 
后退
顶部