龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > web编程 > asp编程 >

asp生成html简单实现程序

时间:2012-12-31 22:56来源:未知 作者:admin 点击:
分享到:
本文章介绍了关于asp生成html简单实现程序,有需要的朋友可参考一下。 代码如下 Function getHttpXML() Set Http = Server.CreateObject(Msxml2.ServerXMLHTTP) dim lResolve,lConnect,lSend,lReceive lResolve = 5*1000 lCo
本文章介绍了关于asp生成html简单实现程序,有需要的朋友可参考一下。
 代码如下
Function getHttpXML()
Set Http = Server.CreateObject("Msxml2.ServerXMLHTTP")
  dim lResolve,lConnect,lSend,lReceive
  lResolve = 5*1000
  lConnect = 5*1000
  lSend = 15*1000
  lReceive = 15*1000
  Http.setTimeouts lResolve,lConnect,lSend,lReceive
  Http.open "POST","http://www.111cn.net",false '抓取需要生成html的页面
  Http.Send()
  if Http.readystate =1 then str1=timer()
  if Http.readystate =4 then str2=timer()
  if Http.readystate <> 4 then
  exit Function
  end if
  'if Http.readystate =0 then str1=timer()
  'getHttpXML=BytesToBstr(Http.responseBody,"utf-8")
  getHttpXML=Http.responseBody
  'getHttpXML=FormatNumber((str2-str1)/1000,3)
  if err.Number<>0 then err.Clear
End Function
'生成文件
Function SaveToFile()
    Dim objStream
    On Error Resume Next
    Set objStream = Server.CreateObject("ADODB.Stream")
    If Err.Number=-2147221005 Then
        Response.Write "<div align='center'>非常遗憾,您的主机不支持ADODB.Stream,不能使用本程序</div>"
        Err.Clear
        Response.End
    End If
    With objStream
        .Type = 1
        .Open
        .Charset = "utf-8"
        .write getHttpXML
        .SaveToFile Server.MapPath("index.html"),2
        .Close
    End With
    Set objStream = Nothing
End Function
call SaveToFile()

收藏文章
表情删除后不可恢复,是否删除
取消
确定
图片正在上传,请稍后...
评论内容为空!
还没有评论,快来抢沙发吧!
按钮 内容不能为空!
立刻说两句吧! 查看0条评论
精彩图集

赞助商链接