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

2016-01-29 18:51 15 1 收藏

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

【 tulaoshi.com - ASP 】

 

<%
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)

(本文来源于图老师网站,更多请访问https://www.tulaoshi.com/asp/)

Set fs=Server.CreateObject("Scripting.FileSystemObject")

(本文来源于图老师网站,更多请访问https://www.tulaoshi.com/asp/)

'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"
%

 

来源:https://www.tulaoshi.com/n/20160129/1507532.html

延伸阅读
标签: Web开发
'***************************************************************** ' function ' 作用 :利用流保存文件 ' 参数 :from(远程文件地址),tofile(保存文件位置) '***************************************************************** Private Function SaveFiles(byref from,byref tof...
标签: ASP
  <html <meta http-equiv="Refresh" content="2" <!-- Place this code into an ASP Page and run it! -- <code Random FileName Creation <% Function Generator(Length) dim i, tempS, v dim c(39) tempS = "" c(1) = "a": c(2) = "b": c(3) = "c": c(4) = "d": c(5) = "e": c(6) =...
标签: ASP
  刚开始学ASP时,照书里HTML中包含ASP 后来,用Response.Write 输出HTML 可现在看了这一篇文章,难道真的要把Response.Write写成一句(" & _? 你说说? ------- (转http://www.ccidnet.com/html//tech/web/2000/11/10/58_1298.html) 什么才是提高ASP性能的最佳选择(一) (作者:青苹果工作室编译 2000年11月10日 17:20) ...
import java.io.File; public class FileMove { /** * 移动指定文件夹内的全部文件 * * @param fromDir * 要移动的文件目录 * @param toDir * 目标文件目录 * @throws Exception */ public static void fileMove(String from, String to) throws Exception { try { File dir = new File(from); // 文件一览 File[] files = dir.l...
标签: ASP
  在我们许多网站中存在这样一个问题,就是链接的维护更新,这是一项工作量很大的工作,若不是的专门工作人员进行维护的大型网站,普通站点的站点更新维护工作基本上都成了一个很令人头疼的问题,特别是在没有很多人手的情况下,要经常维护更新链接更是讨厌,因为这项工作没有多少创意,却很耗时,而JACK显然不是那种喜欢花费大量时间在一...

经验教程

831

收藏

22
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部