Generate an HTML file from the specified ASP file

Source: Internet
Author: User
Title Generate an HTML file from the specified ASP fileSelect blog from aloxy
Keywords Generate an HTML file from the specified ASP file
Source
<%
Function getpage (URL)
Dim Retrieval
Set retrieval = Createobject ("Microsoft. XMLHTTP ")
With Retrieval
. Open "get", URL, false ',"",""
. Send
Getpage = bytestobstr (. responsebody)
End
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 to update the homepage ..."
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>"
%>

Related Article

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.