<%
'获取远程文件
Function GetURL(url)
Set Retrieval = CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "GET", url, False
.Send
GetURL = .responsebody
GetURL = Bytes2BStr(GetURL)
if len(.responsebody)<100 then
response.write "Error: Get URL"
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 GetBetween(Text0, Text1, Text2)
tmp_pos_1 = Instr(Text0, Text1)
tmp_pos_2 = Instr(Text0, Text2)
GetBetween = Mid(Text0, tmp_pos_1 + len(Text1), tmp_pos_2 - tmp_pos_1 - len(Text1))
End Function
function city(code)
Html=GetURL("http://news.163.com/weather/news/qx1/57558.html")
'xxxx01 = GetBetween ( Html, "this.swCity = """, "this.swSubDiv")
'xxxx01 = GetBetween ( Html, "this.swCity = """, "this.swSubDiv")
'xxxx02 = GetBetween ( Html, "this.swTemp = """, "this.swTempCel")
'xxxx03 = GetBetween ( Html, "this.swCIcon = """, "this.swWindS")
'xxxx04 = GetBetween ( Html, "this.swWindS = """, "this.swWindD")
'xxxx05 = GetBetween ( Html, "this.swBaro = """, "this.swHumid")
'xxxx06 = GetBetween ( Html, "this.swHumid = """, "this.swReal")
'xxxx07 = GetBetween ( Html, "this.swReal = """, "this.swUV")
'xxxx08 = GetBetween ( Html, "this.swUV = """, "this.swVis")
'xxxx09 = GetBetween ( Html, "this.swVis = """, "this.swLastUp")
'xxxx10 = GetBetween ( Html, "this.swConText = """, "this.swFore")
'xxxx01 = left(xxxx01, len(xxxx01) - 7)
'xxxx02 = Round(((5/9)*( CDbl(left(xxxx02, len(xxxx02) - 7)) -32)))
'xxxx03 = "weather_icon/" + left(xxxx03, len(xxxx03) - 7) + ".gif"
'xxxx04 = Round(CDbl(left(xxxx04, len(xxxx04) - 7)) * 1.609334, 2)
'xxxx05 = Round(CDbl(left(xxxx05, len(xxxx05) - 7)) * 3.386389, 2)
'xxxx06 = CDbl(left(xxxx06, len(xxxx06) - 7))
'xxxx07 = Round(((5/9)*(CDbl(left(xxxx07, len(xxxx07) - 7)) -32)))
'xxxx08 = CDbl(left(xxxx08, len(xxxx08) - 7))
'xxxx09 = Round(CDbl(left(xxxx09, len(xxxx09) - 7)) * 1.609334)
'xxxx10 = left(xxxx10, len(xxxx10) - 7)
'Response.write ""&xxxx01&" "
'Response.write " "
'Response.write "["&xxxx10&"] "
'Response.write "露点温度:"&xxxx02&"℃ "
'Response.write "感觉温度:"&xxxx07&"℃ "
'Response.write "紫外线强度:"&xxxx08&" "
'Response.write "湿度:"&xxxx06&" % "
'Response.write "风速:"&xxxx04&" 千米/小时 "
'Response.write "能见度:"&xxxx09&" 千米 "
'Response.write "气压:"&xxxx05 & "千帕 "
%>
<%
html=getbetween(html,"天气预报","")
Response.write Html
end function
%>
<%call city("CHXX0010")%> |
24小时免费热线:400-887-6656 |
|