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

ASP
货币大写转换函数的更新
断开的数据库连接的一个例子
本函数计算两个时间的差
一个防止外部数据提交的脚本
一个取图片尺寸的类,支持jpg,gif,png
我在桌面上删帖子
IIS5.0中EXECUTE的巧用
一个简单的SQL语句执行器
ip限制函数
对一篇很长的文章做到完美的分页输出
ADO连接数据库字符串大全(VP,Excel,文本,Sybase,.NET等)
不用询问关闭一个独立的窗口代码
如何正确显示数据库中的图片
精彩OUTLOOK 2000组件放送
基于WEB系统的多语言支持--ASP国际化多语言详细方案
将你的网站设置为客户的信任站点--WSH方案
优化Web数据库页面
浅谈 ASP 程序的编程与优化
认识和优化 connection 对象
多个域名绑定一个空间互不影响

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


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