国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

采用XMLHTTP編寫一個天氣預報的程序

2019-11-18 19:31:25
字體:
來源:轉載
供稿:網友

本人就職于一個本地門戶網站,每天網站上的天氣都得更新。久而久之感到相當麻煩,于是寫了一個定時的新聞小偷,帖出來大家參考一下系統要求: 支持fso, 服務器UDP TCP/ip    沒有屏蔽

下面是小偷的內容
FileName TianQi.asp
Write By Niaoked QQ408611119
www.survivalescaperooms.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('綿陽天氣預報:');" &vbcrlf &  replace(weather,"<BR>",""))
  f.close
  Set f = nothing
  Set fs = nothing
response.write "綿陽天氣預報:"& 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, ">", "&gt;")
   fString = replace(fString, "<", "&lt;")
   fString = Replace(fString, CHR(32), " ")  '&nbsp;
   fString = Replace(fString, CHR(9), " ")   '&nbsp;
   fString = Replace(fString, CHR(34), "&quot;")
   fString = Replace(fString, CHR(39), "&#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
%>


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 哈尔滨市| 惠东县| 清远市| 彭州市| 偃师市| 陇川县| 措美县| 龙川县| 汕尾市| 鄂尔多斯市| 铜梁县| 大荔县| 乐都县| 白山市| 上栗县| 张家港市| 泉州市| 特克斯县| 白河县| 洛川县| 广水市| 衢州市| 诸城市| 酉阳| 石首市| 睢宁县| 休宁县| 柳州市| 宁都县| 万载县| 桃园市| 浮梁县| 鄂托克前旗| 赤水市| 汕尾市| 滦南县| 尤溪县| 阳西县| 红原县| 谢通门县| 石台县|