serverXMLHTTP生成html页面代码

<%
Server.ScriptTimeOut = 90 '设置脚本超时时间

Function getHTTPPage(url)
'On Error Resume Next
dim objXML
set objXML=Server.createobject("MSXML2.ServerXMLHTTP")
objXML.SetTimeOuts 10000,10000,10000,30000
objXML.open "GET",url,false
objXML.send()
If objXML.ReadyState = 4 And objXML.Status = 200 then
getHTTPPage = BytesToBstr(objXML.ResponseBody,"GB2312")
End If
set objXML=nothing
If Err.number<>0 then
getHTTPPage = "error"
Err.Clear
End If
End function

Function BytesToBstr(body,Cset)
set objstream = nothing
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

If request.QueryString("c") = "lear_010_zhi_1120_gogo" Then
Url = "http://www.xxxxxx.com/index.asp"
PageHtml = getHTTPPage(Url)
If PageHtml <> "error" Then
fid = "default.html" '请求参数,指向文件存取相对根目录的路径
Set fso = Server.CreateObject("scripting.FileSystemObject") '创建FSO对象
Set fileObj = fso.opentextfile(server.mappath(fid),2,true) '使用FSO创建文件写入对象
fileObj.Write PageHtml '向文件写入数据,覆盖形式写入
fileObj.close '推送内容写入并关闭写入通道
Set fileObj = nothing
Set fso = nothing
End If

End If
%>
原文地址:https://www.cnblogs.com/lear/p/2350059.html