ASP production of the Weather Report Thief program

Source: Internet
Author: User
Tags chr end split
Program | weather forecast | Thief Program | Weather Forecast | Thief program

Instructions for use:

Submit City Name parameter: weather.asp?city= Beijing

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>"
%>

Enclose the relevant code for the AJAX query weather forecast:

Here's the Weather.js code:
JavaScript Document
var xmlhttp=null;
function Createxmlhttp () {
try {
Xmlhttp=new ActiveXObject ("msxml2.xmlhttp");
}
catch (e) {
try {
Xmlhttp=new ActiveXObject ("Microsoft.XMLHTTP");
}
catch (OC) {
Xmlhttp=null;
}
}
if (!xmlhttp && typeof XMLHttpRequest!= "undefined") {
XMLHTTP = new XMLHttpRequest ();
}
if (!xmlhttp) {
Alert ("Your browser is ajax!");
}
}
function Ajaxpost (Url,reid) {
Createxmlhttp ();
GetMode
Xmlhttp.open ("Get", url,true);
Xmlhttp.setrequestheader ("Content-type", "application/x-www-form-urlencoded");
xmlhttp.onreadystatechange= function () {checkstate (Reid);};
Xmlhttp.send (NULL);
}

function CheckState (Reid) {
if (xmlhttp.readystate = = 4) {
document.getElementById (Reid). Innerhtml= "Loading weather information ...";
if (Xmlhttp.status = = 200) {
var retext = Xmlhttp.responsetext;
document.getElementById (Reid). Innerhtml=retext;
}
}
else{
document.getElementById (Reid). Innerhtml= "Loading weather information ...";
}
}

Here's the index.html code:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>
<title> Weather Interface Thief Program-Arisisi web development, the country's largest web development resources website </title>
<script type= "Text/javascript" >
<!--
function Mm_jumpmenu (targ,selobj,restore) {//v3.0
Eval (targ+ "location=" "+selobj.options[selobj.selectedindex].value+");
if (restore) selobj.selectedindex=0;
}
-->
</script>
<body>
<a href= "www.alixixi.com" ></a>
<br/>
<span id= "Weather" ></span>
<p>
<script src= "Weather.js" language= "JavaScript" ></script>
</p>
<form name= "Form1" Id= "Form1" >
<select name= "Menu1" >
<option value= "" > Please choose City </option>
<option value= "Beijing" > Beijing </option>
<option value= "Shanghai" > Shanghai </option>
<option value= "Nanning" > Nanning </option>
</select>
<div> Weather Thief Program Example </div>
</form>
</body>

If you need a ready-made sample program, please click the link below to download this site:

Http://www.alixixi.com/down/Search.asp?wd=%CC%EC%C6%F8%D4%A4%B1%A8%BD%D3%BF%DA



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.