xkon.Asp
资源名称:4.rar [点击查看]
上传用户:zhbanny
上传日期:2020-11-04
资源大小:161k
文件大小:2k
源码类别:
手机WAP编程
开发平台:
ASP/ASPX
- <!--#Include File="../Inc/Head.Asp"--><%
- '==================================================
- '函数名:GetHttpPage
- '作 用:获取网页源码
- '参 数:HttpUrl ------网页地址
- '参 数:Cset ---------网页编码类型
- '==================================================
- Function GetHttpPage(HttpUrl,Cset)
- If IsNull(HttpUrl)=True Or Len(HttpUrl)<18 Or HttpUrl="$False$" Then
- GetHttpPage="$False$"
- Exit Function
- End If
- If IsNull(Cset)=True Or Cset="$False$" Then
- Cset="GB2312"
- end if
- Dim Http
- Set Http=server.createobject("MSXML2.XMLHTTP")
- Http.open "GET",HttpUrl,False
- On Error Resume Next
- if Err <> 0 then
- Err.Clear
- GetHttpPage="$False$"
- Exit Function
- end if
- Http.Send()
- If Http.Readystate<>4 then
- Set Http=Nothing
- GetHttpPage="$False$"
- Exit function
- End if
- GetHTTPPage=bytesToBSTR(Http.responseBody,Cset)
- Set Http=Nothing
- If Err.number<>0 then
- Err.Clear
- End If
- End Function
- '==================================================
- '函数名:BytesToBstr
- '作 用:将获取的源码转换为中文
- '参 数:Body ------要转换的变量
- '参 数:Cset ------要转换的类型
- '==================================================
- Function BytesToBstr(Body,Cset)
- Dim Objstream
- Set Objstream = Server.CreateObject("adodb.stream")
- 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
- Call H_Title("官方信息")
- Dim xkon1
- xkon1=GetHttpPage("http://wap.xkon.cn/s_h_z_x.Asp","UTF-8")
- If xkon1="$False$" Then
- Response.Write("无相关信息或获取失败")
- Else
- Response.Write(xkon1)
- End If
- Call H_End()
- %>