<%
function ShowError()
Response.write "没有抓取到!"
Response.end
end Function
function ShowError1()
Response.write "没有抓取到1!"
Response.end
end Function
function ShowError2()
Response.write "没有抓取到2!"
Response.end
end Function
'取得网页文件代码函数
function getHTTPPage(url)
dim http
set http=createobject("Microsoft.XMLHTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then
exit function
end if
getHTTPPage=bytes2BSTR(Http.responseBody)
set http=nothing
if err.number<>0 then err.Clear
end function
'字节转化成字符串函数
Function bytes2BSTR(vIn)
dim strReturn
dim i,ThisCharCode,NextCharCode
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
'---------------------------显示详细-------------------------------
shen = 1
shi = "CHXX0407"
if Shi = "" or shi = "0" then
Response.Write "缺少必须参数!"
Response.end
end if
myurl = "http://cn.weather.yahoo.com/CHXX/"&Shi&"/index_c.html" '这里换成别人网站post到的文件地址,你后面可以带参数,例如index.asp??sta_id=57461
Content = getHTTPPage(myurl) '解析成静态的代码
if Content = "" or len(Content) < 500 then ShowError()
'-----图象显示
Temp3 = instr(Content,"<td rowspan=2 align=center valign=middle bgcolor=#eeeeee height=100") '这里的<td row...你要找代码里唯一的,这里是你需要的内容的从什么地方开始的标识
if Temp3 = 0 then showError1()