当前位置: 首页 > 图文教程 > 网络编程 > ASP > 将指定的asp文件内容生成HTML文件

ASP
十天学会ASP之第六天
十天学会ASP之第七天
十天学会ASP之第八天
十天学会ASP之第九天
十天学会ASP之第十天
三天学好ADO之第一天
三天学好ADO之第二天
三天学好ADO之第三天
在ASP中用集合成批操作数据库(一)
在ASP中用集合成批操作数据库(二)
ASP访问SQL Server内置对象
不通过数据源完全控制MDB数据库
ASP数据库简单操作教程
ASP 函数语法速查表
关于Win2K3中利用ASP上传文件的问题
ASP讲座之一:网页开发利器:高效易学的ASP
ASP讲座之二:读取通过表单发送的数据
ASP讲座之三:Application对象与Session对象
ASP讲座之四:ASP内置组件
ASP讲座之五:ASP组件(二)

ASP 中的 将指定的asp文件内容生成HTML文件


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 94 ::
收藏到网摘: n/a

 

<%
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 "开始更新首页..."
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>更新完成!</font>"
%>