新微赢技术网
标题:
将指定的asp文件内容生成HTML文件
[打印本页]
作者:
人杰地灵
时间:
2009-3-16 17:59
标题:
将指定的asp文件内容生成HTML文件
<%Function GetPage(url) dim RetrievalSet 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 objstreamset objstream = Server.CreateObject("adodb.stream")objstream.Type = 1objstream.Mode =3objstream.Openobjstream.Write bodyobjstream.Position = 0objstream.Type = 2objstream.Charset = "GB2312"BytesToBstr = objstream.ReadText objstream.Closeset objstream = nothingEnd Functionon error resume nextUrl="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")) Thenfs.DeleteFile(server.MapPath("./")&"\index.htm")End If
Set CrFi=fs.CreateTextFile(server.MapPath("./")&"\index.htm")Crfi.Writeline(wstr)set CrFi=nothingset fs=nothingresponse.write "...<font color=red>更新完成!</font>"%>
欢迎光临 新微赢技术网 (http://bbs.weiying.cn/)
Powered by Discuz! X3.2