某一页ASP页面生成静态页面

来源:百度知道 编辑:UC知道 时间:2024/05/28 04:14:20
比如这个页面
http://www.downte.com/index.asp
我想在服务器上运行一个asp程序(如:make.asp),把上面这一页输出为静态的页面.

直接运行make.asp就可以生成一个名为index.html文件.
小弟初学asp研究了一上午还没搞定,望高手赐教,用搜索引擎的就不麻烦你转帖了,我一直搜索了一上午咯.

一下是我写的部分源码...但是实现不了,麻烦懂的帮改改.

<%
filename="../index.html"
For I = 1 To Request.Form("BigTextArea").Count
BigTextArea = BigTextArea & Request.Form("BigTextArea")(I)
Next
if BigTextArea<>"" then
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set fout = fso.CreateTextFile(server.mappath(""&filename&""))
fout.Write [BigTextArea]//////////////////// 这里不知道怎么填写.
fout.close
set fout=nothing
set fso=nothing
mskrindex="ok"
end if
%>

'1、输入url目标网页地址,返回值getHTTPPage是目标网页的html代码
Function GetHTTPPage(url)
dim Http
set Http=server.createobject("MSXML2.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

'2、转换乱玛,直接用xmlhttp调用有中文字符的网页得到的将是乱玛,可以通过adodb.stream组件进行转换
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

'来源地址和要生成的页面名称