| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 448 人关注过本帖
标题:[求助]生成静态页
只看楼主 加入收藏
tulipdwh
Rank: 1
等 级:新手上路
帖 子:79
专家分:0
注 册:2006-10-18
收藏
 问题点数:0 回复次数:1 
[求助]生成静态页
下面这种方法为什么不能生成呢。希望大家帮忙看一下,谢谢了。
<%
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://localhost/fs.asp"'要读取的页面地址
response.write "开始更新首页..."
wstr = GetPage(Url)
'response.write(wstr)
Set fs=Server.CreateObject("Scripting.FileSystemObject")
'要存放的页面地址
dizhi=server.MapPath("fs.htm")
If (fs.FileExists(dizhi)) Then
fs.DeleteFile(dizhi)
End If
Set CrFi=fs.CreateTextFile(dizhi)
Crfi.Writeline(wstr)
set CrFi=nothing
set fs=nothing
response.write "...<font color=red>更新完成!</font>"
%>
搜索更多相关主题的帖子: 静态 
2007-01-17 10:46
tang688
Rank: 5Rank: 5
等 级:贵宾
威 望:16
帖 子:1219
专家分:35
注 册:2004-12-25
收藏
得分:0 
<%
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://localhost/fs.asp"'要读取的页面地址
response.write "开始更新首页..."
wstr = GetPage(Url)
'response.write(wstr)
Set fs=Server.CreateObject("Scripting.FileSystemObject")
'要存放的页面地址
dizhi=server.MapPath("fs.htm")
If (fs.FileExists(dizhi)) Then
fs.DeleteFile(dizhi)
End If
Set CrFi=fs.CreateTextFile(dizhi)
Crfi.Writeline(wstr)
set CrFi=nothing
set fs=nothing
response.write "...<font color=red>更新完成!</font>"
%>

2007-01-22 17:00
快速回复:[求助]生成静态页
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011680 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved