Google搜索结果自定义显示解决方案

chen_hh2 2008-06-08 06:27:54
如果想在自己的网站内加入google搜索或其它搜索,把搜索的结果用自己的页面展示出来,应该怎么实现??
...全文
106 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
Navymk 2008-06-09
  • 打赏
  • 举报
回复
xhr(post) + 正则
不过翻页会相当麻烦
xiaojing7 2008-06-08
  • 打赏
  • 举报
回复
1楼正解
YH_Random 2008-06-08
  • 打赏
  • 举报
回复
Google有这方面的服务,可以购买一个。。


免费的话,就用楼上说的思路,xmlhttp,获取网页返回结果再抓出自己想要的
  • 打赏
  • 举报
回复
使用xmlhttp
给一个xmlhttp的简单例子

<style type="text/css">
<!--
body{background: #fff;margin:0;}
table,td,img,form{border: none;margin: 0;padding: 0;}
td,p,li,select,input,textarea{font-size:12px;}
a{text-decoration:underline;}
a:link{color:#00007f;}
a:visited{color:#00007f;}
a:active,a:hover{color:#f00;}
-->
</style>
<%
On Error Resume Next
Server.ScriptTimeOut=9999999
Function getHTTPPage(Path)
t = GetBody(Path)
getHTTPPage=BytesToBstr(t,"GB2312")
End function
Function GetBody(url)
on error resume next
Set Retrieval = CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "Get", url, False, "", ""
.Send
GetBody = .ResponseBody
End With
Set Retrieval = Nothing
End Function

Function BytesToBstr(body,Cset)
dim objstream
set objstream = Server.CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function
Function Newstring(wstr,strng)
Newstring=Instr(lcase(wstr),lcase(strng))
if Newstring<=0 then Newstring=Len(wstr)
End Function


Dim wstr,str,url,start,over,dtime

url="http://www.ip138.com/ip2city.asp"
wstr=getHTTPPage(url)
start=Newstring(wstr,"[")
over=Newstring(wstr,"]")
body=mid(wstr,start+1,over-start-1)
start1=Newstring(wstr,"来自:")
over1=Newstring(wstr,"</center>")
body1=mid(wstr,start1+3,over1-start1-3)
response.write body
response.write body1
%>

87,907

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧