以下是代码片段: <% Set Http = Server.CreateObject("Microsoft.XMLHTTP") Set objstream = Server.CreateObject("AdoDb.Stream") Set fs = Server.CreateObject("Scripting.FileSystemObject") Set txtFile = fs.CreateTextFile(Server.MapPath("10000.htm")) txtFile.Write(getHTTPPage("http://192.168.1.3:5002/index.asp" )) txtFile.Close HttpNothing Set txtFile = Nothing Set fs = Nothing Function getHTTPPage(url) if InStr(url,"http://") = 0 then Response.Write("RunTime Has An Error! Please Check URL!") Response.End end if Http.open "GET",url,false Http.send() If Http.readystate <> 4 Then Exit Function getHTTPPage = BytesToBstr(HTTP.ResponseBody) If Err.Number <> 0 then Err.Clear End function Function BytesToBstr(body) objstream.Type = 1 objstream.Mode = 3 objstream.Open objstream.Write body objstream.Position = 0 objstream.Type = 2 objstream.Charset = "GB2312" BytesToBstr = objstream.ReadText objstream.Close End Function
Sub HttpNothing() Set Http = Nothing Set objstream = Nothing End Sub %> | 飞飞,Asp技术乐园
|