麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 編程 > ASP > 正文

用ASP+XMLHTTP編寫一個天氣預(yù)報程序

2024-05-04 11:07:41
字體:
供稿:網(wǎng)友
本人就職于一個本地門戶網(wǎng)站,每天網(wǎng)站上的天氣都得更新。久而久之感到相當(dāng)麻煩,于是寫了一個定時的新聞小偷,帖出來大家參考一下系統(tǒng)要求: 支持FSO, 服務(wù)器UDP TCP/IP 沒有屏蔽。

  下面是小偷的內(nèi)容:

FileName TianQi.asp
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
  next
  weather=replace(weather,"1$","<FONT color=#ffffff>【今天】</FONT>")
  weather=replace(weather,"2$","<FONT color=#ffffff>【明天】</FONT>")
  weather=replace(weather,"3$","<FONT color=#ffffff>【后天】</FONT>")
  Set fs = CreateObject("Scripting.FileSystemObject")
  Set f = fs.CreateTextFile(request.ServerVariables("APPL_PHYSICAL_PATH")& "tq.js", True)
  f.write("document.write('綿陽天氣預(yù)報:');" &vbcrlf & replace(weather,"<BR>",""))
  f.close
  Set f = nothing
  Set fs = nothing
  response.write "綿陽天氣預(yù)報:"& weather
  Set oXMLHTTP = Nothing
  if err.number<>0 then
   response.write "出錯了,錯誤描述:"&err.description & "<br>錯誤來源"& err.source
   response.End()
  end if
 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
 Public Function HTMLEncode(fString)
  If Not IsNull(fString) Then
   fString = replace(fString, ">", ">")
   fString = replace(fString, "<", "<")
   fString = Replace(fString, CHR(32), " ") ' 
   fString = Replace(fString, CHR(9), " ") ' 
   fString = Replace(fString, CHR(34), """)
   fString = Replace(fString, CHR(39), "'") '單引號過濾
   fString = Replace(fString, CHR(13), "")
   fString = Replace(fString, CHR(10) & CHR(10), "</P><P> ")
   fString = Replace(fString, CHR(10), "<BR> ")
   HTMLEncode = fString
  End If
 End Function
%>

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 在线观看国产日韩 | 成人免费在线观看视频 | 日本a∨精品中文字幕在线 欧美1—12sexvideos | 中文字幕涩涩久久乱小说 | 国产精品中文在线 | 成人三级电影网 | 高清国产在线 | 欧美激情视频一区二区免费 | 亚洲综合色视频在线观看 | 精品xxxx户外露出视频 | 18被视频免费观看视频 | 成年免费在线视频 | 欧美性生交大片 | 国产精品一区二区三区在线看 | av大全在线播放 | 黑色丝袜美美女被躁视频 | h视频免费在线观看 | 欧美视频一区二区三区在线观看 | 香蕉成人在线观看 | 日韩高清影视 | 免费看成年人网站 | 日本欧美一区二区三区在线播 | 亚洲日本韩国在线观看 | 欧美精品一区二区久久久 | 午夜视频色 | 免费一区区三区四区 | 欧美性视频一区二区 | 毛片视频网站在线观看 | japanesexxxx24videofree| 色播视频在线播放 | 宅男视频在线观看免费 | 九一国产精品 | 国内毛片视频 | 色播一区| 精品成人免费一区二区在线播放 | 九九热在线视频观看 | 国产精品99一区二区 | 真人一级毛片免费 | 99re热精品视频 | 国产 视频 一区二区 | 综合网日日天干夜夜久久 |