asp通过xml http获取网页不完整
自己写的友情链接检查工具,一直用得挺好,不过最近有人说,输入他的网址后,工具提示找不到友情链接。其中一个用户提出的网址为:http://www.nipei.com/index.php
于是按照惯例,在本地进行调试。发现确实找不到友情链接,仔细看看通过xmlhttp返回的内容,到了某个地方后,后面部分竟然丢失了,仔细检查了xmlhttp获取网页的方法,也看了二进制转换成字符串的函数,可是一直没能找到这个问题的原因。百度和google也搜索了,不过都没有类似的问题,真是郁闷到了极点。
写了个最简单的代码如下:
<%
url="http://www.nipei.com/index.php"
Set Http=server.createobject("msxml2.serverxmlhttp.3.0")
Http.setTimeouts 10000, 10000, 10000, 10000
Http.open "GET",url,False
Http.Send()
If Http.Readystate<>4 Then
Else
    
    If Http.status=200 Then
        response.write BytesToBstr(http.responseBody,"gb2312")
    End If
End If
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
%>
相关新闻>>
- 发表评论
 - 
				
 
- 最新评论 进入详细评论页>>
 


