我爱Aspx >> Asp.Net >> 用ASP+XMLHTTP编写一个天气预报程序本人就职于一个本地门户网站,每天网站上的天气都得更新。久而久之感到相当麻烦,于是写了一个定时的新闻小偷,帖出来大家参考一下系统要求: 支持FSO, 服务器UDP TCP/IP 没有屏蔽。
下面是小偷的内容:
Write By Niaoked QQ408611119
www.knowsky.com
<%
if hour(now)=9 and minute(now)<30 then
getCategories()
end if
Function getCategories()
on error resume next
Dim oXMLHTTP ' As Object
Dim oCategories ' As Object
Dim BodyText
Dim Pos,Pos1
Set oXMLHTTP = CreateObject("Microsoft.XMLHTTP")
'--- set the XMLHTTP call and issue send (no parm as category
'--- is included in URL
oXMLHTTP.open "GET","http://weather.china.com.cn/travel_gntq.PHP?cityid=56196&cityname=绵阳",False '这个地方换成你自己的地址
oXMLHTTP.send
'--- load the response into the Categories data island
BodyText=oXMLHTTP.responsebody
BodyText=BytesToBstr(BodyText,"gb2312")
Pos=Instr(BodyText,"<body")
pos1=Instr(BodyText,"</body>")
BodyText=mid(BodyText,pos,pos1)
BodyText=split(BodyText,"<table")
Pos=Instr(BodyText(4),"<tr")
pos1=Instr(BodyText(4),"</tr>")
Body=mid(BodyText(4),pos,len(BodyText(4))-pos)
body=split(body,"</table>")
body1=split(replace(replace(replace(body(0),"<br>",""),"</td>",""),"</tr>",""),"天气")
for i= 1 to ubound(body1)
body3=split(body1(i),"<td")
weather=weather & "document.write("""& i&"$" & "天气" & HTMLEncode(trim(body3(0))) & """);" & VBcrlf
Ҷƪл˵?
学以致用 驳“ASP低能论”[05-15]
ASP开发中存储过程应用全接触[05-15]
ASP正则表达式详解[05-15]
ASP中非数据库实现数据对象的定义..[05-15]
为自己的ASP网站系统构建一套标记..[05-15]
Asp+Sql 对数据库的各种操作[05-15]
asp组件上传[05-15]
ASP中Request对象获取客户端数据..[05-15]
编程爱好者的福音 让IIS6.0支持A..[05-15]
ASP计数器[05-15]
学以致用 驳“ASP低能论”[05-15]
ASP开发中存储过程应用全接触[05-15]
ASP正则表达式详解[05-15]
ASP中非数据库实现数据对象的定义..[05-15]
为自己的ASP网站系统构建一套标记..[05-15]
Asp+Sql 对数据库的各种操作[05-15]
asp组件上传[05-15]
ASP中Request对象获取客户端数据..[05-15]
编程爱好者的福音 让IIS6.0支持A..[05-15]
ASP计数器[05-15]