关于asp自动生成html并覆盖原html

来源:百度知道 编辑:UC知道 时间:2024/07/05 03:31:16
<%
dim read,Curl,content

Curl="http://localhost/index.asp"
read=getHTTPPage(Curl)

if read<>"" then
content=read
call makeindex()
end if

sub makeindex()
Set Fso = Server.CreateObject("Scripting.FileSystemObject")
Filen=Server.MapPath("index.html")
Set Site_Config=FSO.CreateTextFile(Filen,true, False)
Site_Config.Write content
Site_Config.Close
Set Fso = Nothing
Response.Write("<script>alert('已经成功生成首页!')</script>")
end sub

Function getHTTPPage(url)
dim http
set http=Server.createobject("Microsoft.XMLHTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then
exit function
end if
getHTTPPage=bytesToBSTR(H

<%
dim read,Curl,content

Function getHTTPPage(url)
dim http
set http=Server.createobject("Microsoft.XMLHTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then
exit function
end if
getHTTPPage=bytesToBSTR(Http.responseBody,"GB2312")
set http=nothing
if err.number<>0 then err.Clear
End function

Function BytesToBstr(body,Cset)
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 = Cset
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function

Curl="http:/