要死人了,请高手救命啊!!!!!!!
刘云涛 2004-08-05 11:02:32 <%
'以下是我摘抄一位GG的代码,生成静态页面
'可http://www.bhfcc.com/index.asp 9点以后上传的东西就取不到了,不知道为什么,
'请高手指点迷津
'获取网页内容
Function GetHtmlCode(url)
dim http
set http=Server.createobject("Microsoft.XMLHTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then
exit function
end if
GetHtmlCode=bytesToBSTR(Http.responseBody,"GB2312")
set http=nothing
if err.number<>0 then err.Clear
End function
'编码转换
Function BytesToBstr(body,Cset)
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 = Cset
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function
'写文件
Function WriteHtml(htmlcode,htmlname)
Dim fpath,fname,fso,fout,Fso_del
fname=htmlname '文件名
Set fso = Server.CreateObject("Scripting.FileSystemObject")
'如果文件存在删除文件
If fso.FileExists(server.mappath(fname)) Then
Set Fso_del = fso.GetFile(server.mappath(fname))
Fso_del.Delete
End if
'生产新的数据页面
Set fout = fso.Createtextfile(server.mappath(fname),true)
fout.writeline htmlcode '内容
fout.close
set fout=nothing
set fso=nothing
WriteHtml="写入文件:" & server.mappath(htmlname) & " 静态页面已生成"
End Function
dim url,code,r,name
url="http://www.bhfcc.com/index.asp" '网址
name="lytback.htm" '//文件名
code=GetHtmlCode(url)
r=WriteHtml(code,name)
Response.write r
%>