The code is as follows
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.3lian.com/", 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 "
Unfortunately, your host does not support ADODB.stream and cannot use this program
"
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 ()