仁怀市教育网,奇拉维特任意球,曲靖市
抓取网页。偶要实现实实更新天气预报。利用了xmlhttp,抓取网页的指定部分。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
%>
<html>
<body bgcolor=#ffffff leftmargin=0 topmargin=0 marginheight=0 marginwidth=0>
<!-- 开始 -->
<%
dim wstr,str,url,start,over,dtime
dtime=year(date)&"年"&month(date)&"月"&day(date)&"日"
url="http://www.qianhuaweb.com/"
wstr=gethttppage(url)
start=newstring(wstr,dtime)
over=newstring(wstr,"</p>")
body=mid(wstr,start,over-start)
response.write "<marquee onmouver=this.stop(); onmouseout=this.start();>"&body&"</marquee>"
%>
<!-- 结束 -->
</body></html>
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
asp.net搭建博客,使用BlogEngine.NET+MySql搭建博客
网友评论