Generate html| Generate HTML <%
Function getpage (URL)
Dim retrieval
Set retrieval = CreateObject ("Microsoft.XMLHTTP")
With retrieval
. Open ' get ', url, False ', ' ', ' ', ' '
. Send
GetPage = Bytestobstr (. Responsebody)
End With
Set retrieval = Nothing
End Function
Function Bytestobstr (body)
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 = "GB2312"
Bytestobstr = objstream. ReadText
Objstream. Close
Set objstream = Nothing
End Function
On Error Resume Next
Url= "Http://www.taiang.com.cn/index.asp"
Response.Write "Start updating the home page ..."
WSTR = GetPage (URL)
Set fs=server.createobject ("Scripting.FileSystemObject")
' If not myfile.folderexists (server. MapPath ("/html/")) Then
' Myfile.createfolder (server. MapPath ("/html/")) '
' End If
If (fs. FileExists (server. MapPath ("./") & "\index.htm") Then
Fs. DeleteFile (server. MapPath ("./") & "\index.htm")
End If
Set Crfi=fs. CreateTextFile (server. MapPath ("./") & "\index.htm")
Crfi.writeline (WSTR)
Set crfi=nothing
Set fs=nothing
Response.Write "... <font color=red> update complete! </font> "
%>