百度风云榜搜索前50名钩子源码

前端之家收集整理的这篇文章主要介绍了百度风云榜搜索前50名钩子源码前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

发表于中国站长站(Chinaz.com)论坛的贴子。

可在页面任何地方调用调用方法<!--#include file="baidutop50.asp"-->

据发表人说可有效提高网站在搜索引擎中的排名。

baidutop50.asp源代码

<%
dim url,page,rr,i,cutpage,str
'on error resume next
 Function getHTTPPage(url)
 'on error resume next
  dim http
  set http=Server.createobject("Microsoft.XMLHTTP")
  Http.open "GET",url,false
  Http.send()
  if Http.readystate<>4 then
   exit function
  end if
  getHTTPPage=bytesToBSTR(Http.responseBody,"GB2312")
  set http=nothing
  if err.number<>0 then err.Clear 
 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
'===================================================
url="http://top.baidu.com/top_keyword.html"
page= getHTTPPage(url)
cutpage=split(page,"<td width="&chr(34)&"124"&chr(34)&">")
str=""
for i=1 to ubound(cutpage)
rr=instr(cutpage(i),"</td>")
str=str&mid(cutpage(i),1,rr-1)&" "
next
str=replace(replace(str,"<div align="&chr(34)&"center"&chr(34)&">",""),"</div>","")
response.Write("<marquee direction='up' height='1' width='1' id='xp' scrollamount='1' scrolldelay='100' width='100%' align='center' border='0'><b>"&str&"</b></marquee>")
%>

猜你在找的Asp相关文章