当前位置: 代码迷 >> 综合 >> Asp generate Html
  详细解决方案

Asp generate Html

热度:79   发布时间:2023-12-13 16:02:10.0
<%Function getHTTPPage(URL) '从网络读取文件
Dim http
Set http = CreateObject("MSXML2.XMLHTTP")
http.Open "GET", URL, False
http.send
If http.ReadyState <> 4 Then
Exit Function
End If
getHTTPPage = BytesToBstr(http.responseBody, "GB2312")
Set http = Nothing
If err.Number <> 0 Then err.Clear
End Function
Function BytesToBstr(body, Cset) '从网络读取文件
Dim objstream
Set objstream = 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 ASP2HTM(URL,EXname)
HTMLCode=GetHTTPPage(URL)
filename=Exname
if HTMLCode<>"" then
set fso = Server.CreateObject("Scripting.FileSystemObject")
set fout = fso.CreateTextFile(server.mappath(""&filename&""))
fout.write HTMLCode
fout.close
set fout=nothing
set fso=nothing
end if
END sub
%>
Call ASP2HTM(http://www.100tiyan.cn/index.asp,"Default.htm")
  相关解决方案