Using Asp+xmlhttp to prepare weather forecast programs

Source: Internet
Author: User
Tags object end prepare split
asp+|xml| Program | Weather forecast
I work for a local portal, and the weather on the website is updated every day. Over time feel quite troublesome, so wrote a timed news thief, posted out everyone reference system requirements: Support FSO, server UDP TCP/IP is not shielded.

Here are the thieves ' contents:

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= Mianyang", False ' Change this place to your own address.
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 (body (0),
"," ")," </td> "," ")," </tr> "," "", "weather")
For i= 1 To UBound (body1)
Body3=split (Body1 (i), "<TD")
Weather=weather & "document.write (" "& i&" $ "&" Weather "& HTMLEncode (Trim (body3 (0)) &" ""); "& V Bcrlf
Next
Weather=replace (Weather, "1$", "<font color= #ffffff" "Today" </FONT>)
Weather=replace (Weather, "2$", "<font color= #ffffff" "Tomorrow" </FONT>)
Weather=replace (Weather, "3$", "<font color= #ffffff" "The day after" </FONT>)
Set fs = CreateObject ("Scripting.FileSystemObject")
Set f = fs. CreateTextFile (Request. ServerVariables ("Appl_physical_path") & "Tq.js", True)
F.write ("document.write (' Mianyang weather forecast: ');" &vbcrlf & Replace (weather, "
",""))
F.close
Set F = Nothing
Set fs = Nothing
Response.Write "Mianyang Weather forecast:" & Weather
Set oxmlhttp = Nothing
If Err.Number <> 0 Then
Response.Write "Error, Description: &err.description &"
Error source "Err.Source
Response. End ()
End If
End Function

[1] [2] Next page



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.