◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。
Asp实现搜索引擎联合体


不过,说起他有多简单你可能不敢相信,我这写了一个,你会发现只是这点东西就足够了,远不是什么所谓的双搜技术...
效果如下:点击看看baidugoogle.asp
代码如下:
<%If isempty(Request.querystring("q")) and isempty(Request.querystring("b")) then %>
<FORM action="" method="get">
<INPUT size=42 name=q>
<INPUT type=submit value="baidugoogle搜索">
</FORM>
<%end if
if not isempty(Request.querystring("q")) then%>
<FRAMESET cols=50%,*>
<FRAME src="http://www.google.com/search?q=<%=Request.querystring("q")%>">
<FRAME src="?b=<%=Request.querystring("q")%>">
</FRAMESET>
<%end if%>
<%If not isempty(Request.querystring("b")) then
Set http=Server.CreateObject("Microsoft.XMLHTTP")
http.Open "GET","http://www.baidu.com/s?wd="&Request.querystring("b"),False
http.send
set objstream = Server.CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write http.responseBody
objstream.Position = 0
objstream.Type = 2
objstream.Charset = "GB2312"
Set objRegExp=New RegExp
objRegExp.IgnoreCase =True
objRegExp.Global=True
objRegExp.Pattern="<script(?:\s*|.*?)*script>"
aaa=objRegExp.Replace(objstream.ReadText,"")
objRegExp.Pattern="=s\?"
aaa=objRegExp.Replace(aaa,"=http://www.baidu.com/s?")
objRegExp.Pattern="=""s\?"
Response.write objRegExp.Replace(aaa,"=""http://www.baidu.com/s?")
Set objRegExp=Nothing
objstream.Close
set objstream = nothing
Set http=Nothing
end if
%>
如代码有错误,请通知我,谢谢.
|
|
||
|
|
|
|
![]() |
||
发布:Debugger | 分类:代码收集 | 引用本文 | 发表评论 | 返回顶部
- 原创文章如转载请注明:来自[闻思家园]:http://www.winshome.com/coding/2006-11/118.html
