用XMLHTTP生成静态页面...为什么本地可以用,但是一放到网上就不行?

zyyking 2006-05-19 11:23:18
Function getHTTPPage(url)
On Error Resume Next
dim http
set http=Server.createobject("Microsoft.XMLHTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then'判断文档是否已经解析完,以做客户端接受返回消息
exit function
end if
getHTTPPage=bytesToBSTR(Http.responseBody,"GB2312")'返回信息,同时用函数定义编码
set http=nothing
If Err.number<>0 then
Response.Write "<p align='center'><font color='red'><b>服务器获取文件内容出错</b></font></p>"
Err.Clear
End If
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 = "GB2312"
'转换原来默认的UTF-8编码转换成GB2312编码,否则直接用XMLHTTP调用有中文字符的网页得到的将是乱码
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function

dim rs,fso,fout,gycode,city,scode,rcode,Url,Html

response.write "<p align=center><font color=blue>正在操作,请耐心等待,不要退出!</font><br><br>"

city=split(request("buyregion"),",")
Set fso = Server.CreateObject("Scripting.FileSystemObject")

j=0
for i=0 to ubound(city)

Url = "http://www.2112112.com/1.asp?cityname=3301"
Html = getHTTPPage(Url)
' response.write(Html)

Set foutr = fso.CreateTextFile(server.mappath("../3301.htm"))
foutr.WriteLine Html
foutr.close
-----------------------------------------
为什么本地可以用,但是一放到网上就不行?

不知道怎么回事???????WHY?

...全文
130 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
zyyking 2006-05-19
  • 打赏
  • 举报
回复
不会的..
权限没有问题的.........页面生成的,但是内容写不出来,是白白的
但是本地生成的是有东西的
moodboy1982 2006-05-19
  • 打赏
  • 举报
回复
没有权限吧。
zyyking 2006-05-19
  • 打赏
  • 举报
回复
提示:
错误 '800c0005'
/1.asp,行93

刚好是Http.send()

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧