ASP generates HTML simple implementation program

Source: Internet
Author: User
The code is as follows Copy Code
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 ' crawl pages that need to generate 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
' Generate file
Function SaveToFile ()
Dim objstream
On Error Resume Next
Set objstream = Server.CreateObject ("ADODB. Stream ")
If err.number=-2147221005 Then
Response.Write "<div align= ' center ' > Very sorry, your host does not support ADODB.stream, can not use this program </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 ()

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.