<[email protected]="VBSCRIPT" CODEPAGE="936"%>
<%
Response.Write(Server.HTMLEncode(GetHttpPage("http://localhost/Index.asp教程","GB2312")))
==============================
函 數 名:GetHttpPage
作 用:獲取頁面源代碼函數
參 數:網址HttpUrl
==============================
Function GetHttpPage(HttpUrl,Code)
If IsNull(HttpUrl)=True Or HttpUrl="" Then
GetHttpPage="A站點維護中!"
Exit Function
End If
On Error Resume Next
Dim Http
Set Http=server.createobject("MSX"&"ML2.XML"&"HTTP")
Http.open "GET",HttpUrl,False
Http.Send()
If Http.Readystate<>4 then
Set Http=Nothing
GetHttpPage="B站點維護中!"
Exit function
End if
GetHttpPage=BytesToBSTR(Http.responseBody,Code)
Set Http=Nothing
If Err.number<>0 then
Err.Clear
GetHttpPage="C站點維護中!"
Exit function
End If
End Function
==============================
函 數 名:BytesToBstr
作 用:轉換編碼函數
參 數:字符串Body,編碼Cset
==============================
Function BytesToBstr(Body,Cset)
Dim Objstream
Set Objstream = Server.CreateObject("ado"&"d"&"b.st"&"re"&"am")
Objstream.Type = 1
Objstream.Mode =3
新聞熱點
疑難解答