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

ASP
论坛树状记录表的堆栈展开
Oracle大文本在ASP中存取问题的解决
ASP创建SQL Server数据库的两种方法
浅谈session_onend的调试
用ASP访问数据库的几种常见方式
教你一次下载网页中的所有资源
20种看asp源码的方法及工具
在ASP中使用智岛网格控件全过程
解决使用ASP无法连接ORACLE 9i数据库的问题
用Js判断输入的时间是否有效
ADO数据与XML数据间的转换的类
使用命名管道访问SQL Server
网页加速之网页结构篇
在红蜻蜓中实现多房间
在ASP中使用Oracle数据库技巧
关于分页办法
在VB中使用API函数(Any)
网站ASP漏洞小总结
网页之定时器详解
实用函数- 判断输入的是否是电话号码

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 67 ::
收藏到网摘: 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>"
%>