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/archive/2012/02/13/2350059.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值