<%'定義XMLhttp
function GetXMLText(Url)
dim GetXMLHttp
set GetXmlHttp=server.Createobject("Microsoft.XMLHTTP")
GetXMLHttp.open "Get",url,false,"",""
GetXMLHttp.Send
'GetXmlText=GetXMLHttp.Responsetext
GetXmlText=GetXMLHttp.ResponseBody
set GetXMLHttp=nothing
end function
'轉換為字符
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
'保存文件
Sub SaveToFile(strBody,File)
Dim obJStream
Set obJStream = Server.CreateObject("ADODB.Stream")
With obJStream
.Type = 2
.Open
.Charset = "GB2312"
.Position = obJStream.Size
.WriteText = strBody
.SaveToFile Server.MapPath(File),2
.Close
End With
Set obJStream = Nothing
End Sub
%>
<% SaveFile BytesToBstr(GetXMLText("http://127.0.0.1/index.ASP"),"GB2312"),"index.htm"%>