The following is the weather.asp source code: <% @LANGUAGE = "VBSCRIPT" codepage= "936"%> <% On Error Resume Next Dim fcity Fcity=trim (Request ("City")) If fcity= "" Then Fcity = Server.URLEncode ("Beijing") End If Function GetURL (URL) Set retrieval = CreateObject ("Microsoft.XMLHTTP") With retrieval . Open ' get ', url, False . Send GetURL = Bytes2bstr (. responsebody) If Len (. responsebody) <100 Then Response.Write "Get weather <a href=" &url& "target=_blank>" &url& "</a> failure. " Response.End End If End With Set retrieval = Nothing End Function function Bytes2bstr (VIN) Strreturn = "" For i = 1 to LenB (VIN) Thischarcode = ASCB (MidB (vin,i,1)) If Thischarcode < &h80 Then Strreturn = Strreturn & Chr (Thischarcode) Else Nextcharcode = ASCB (MidB (vin,i+1,1)) Strreturn = Strreturn & Chr (CLng (thischarcode) * &h100 + CInt (nextcharcode)) i = i + 1 End If Next Bytes2bstr = Strreturn End Function Function Readtextarea (HTMLSTR) Set RA = New RegExp Ra. IgnoreCase = True Ra. Global = True Ra. Pattern = ". {0,}<textarea[^>]+> ([. \r\n\s\t]+?) <\/textarea>. {0,} " Readtextarea = Ra.replace (Htmlstr, "$") End Function Function Getkey (Html,start,last) Filearray=split (Html,start) Filearray2=split (Filearray (1), last) Getkey=filearray2 (0) End Function Dim htmlstr Dim w_date,w_pic1,w_pic2,w_m1,w_m2,w_m3 Htmlstr = GetURL ("http://weather.tq121.com.cn/mapanel/index1.php?city=" &fcity& ")" W_date = Getkey (Htmlstr, "<span class=" "BIG-CN" ">", "</span>") W_pic1 = Getkey (Htmlstr, "<td width=" "," "valign=" "Top" ">W_pic2 = Getkey (Htmlstr, "<td width=" "The" "valign=" "Top" ">W_M1 = Getkey (htmlstr, <td width= "160" "align=" "Center" "valign=" "Top" "class=" "Weather" ">", "</td>") w_m2 = Getkey (htmlstr, <td width= "160" "align=" "Center" "valign=" "Top" "class=" "Weatheren" ">", "</td>") W_M3 = Getkey (htmlstr, <td width= "153" "valign=" "Top" "><span class=" "BIG-CN" ">", "</span>") Response.Charset = "GB2312" Response.Write "<table width=" "100%" "border=" "0" "cellspacing=" "0" "cellpadding=" "0" ">" Response.Write "<tr>" Response.Write "<td width=" "45%" "style=" "Text-align:center" "" ><img src= "images/" &w_pic1& "" "Width=" "70" "" "Height=" "Response.Write" "/><div style=" "Text-align:center;" > "&w_m1&" </div></td> " Response.Write "<td width=" "55%" "><table width=" "100%" "border=" "0" "cellspacing=" "0" "cellpadding=" "0" " > " Response.Write "<tr>" Response.Write "<td height=" "class=" "Zi_he" ">" &w_date& "</td>" Response.Write "</tr>" Response.Write "<tr>" Response.Write "<td height=" "class=" "Zi33" ">" &w_m2& "</td>" Response.Write "</tr>" Response.Write "<tr>" Response.Write "<td height=" "class=" "Zi33" ">" &w_m3& "</td>" Response.Write "</tr>" Response.Write "</table>" %> |