⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index1.asp

📁 预知天气 简单方便 可靠 使用 简单名了
💻 ASP
字号:
<!--
------------------------------------
----       说明-很重要            --
--                                --
--文件名:   index1.asp           --
--功能  :获取周边天气            --
--注意:失败的话修改相关参数      --
--蚊子小偷之--雅虎天气            --
--QQ:127029751  by www.818699.com--
------------------------------------
--->
<!--#include file=config.asp--><%
dim weburl,cx_city
'请修改为你的网址
weburl="www.818699.com"
cx_city=request("city")
'cx_city=Server.Urlencode(cx_city)
if cx_city = "" then
cx_city = "hechi"
 end if
'远程截取函数开始
Server.ScriptTimeOut=9999999
Function getHTTPPage(Path)
        t = GetBody(Path)
        getHTTPPage=BytesToBstr(t,"utf-8")
End function

Function GetBody(url) 
        on error resume next
        Set Retrieval = CreateObject("Msxml2.ServerXMLHTTP") 
        With Retrieval 
        .Open "post", url, False, "", "" 
        .Send 
        GetBody = .ResponseBody
        End With 
        Set Retrieval = Nothing 
End Function

Function BytesToBstr(body,Cset)
dim objstream
s="stream"
set objstream = Server.CreateObject("adodb."&s)
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function

Function Newstring(wstr,strng)
        Newstring=Instr(lcase(wstr),lcase(strng))
        if Newstring<=0 then Newstring=Len(wstr)
End Function
'

'截取网址
url="http://weather.cn.yahoo.com/weather.html?city="&cx_city

        wstr=getHTTPPage(url)
'截取数据
set reg=new Regexp
    reg.Multiline=True
    reg.Global=Flase
    reg.IgnoreCase=true
    reg.Pattern=""&cx_cj3&"((.|\n)*?)"&cx_cj4&""
    Set matches = reg.execute(wstr)
        For Each match1 in matches
            bodypage=match1.Value
            if bodypage = "" then
            bodypage = "noting"
            end if
            
        Next
Set matches = Nothing
Set reg = Nothing
bodypage=replace(bodypage,"http://cn.yimg.com/i/js/wea","js")
bodypage=replace(bodypage,"http://cn.yimg.com/i/wea/v1","images")
bodypage=replace(bodypage,"http://cn.yimg.com/i/wea","images/gif")bodypage=replace(bodypage,"ico/32x32","gif")
bodypage=replace(bodypage,"http://weather.cn.yahoo.com/weather.html","")
response.write "<div><div>"&bodypage
%> 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -