使用XMLHTTPClass 和 HttpWebRequest 不能获得相应数据
我用httplook获得一个网页的信息
HTTP/1.1 200 OK
Date: Thu, 22 Mar 2007 05:08:36 GMT
Server: Apache
X-Powered-By: PHP/4.3.9
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Last-Modified: Thu, 22 Mar 2007 05:08:36 GMT
Cache-Control: no-cache, must-revalidate
Pragma: no-cache
Content-Encoding: gzip
Content-Length: 1823
Connection: close
Content-Type: text/html; charset=gb2312
<html>
<head>
<title> 具体信息 </title>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb23121 ">
<script
language= "JavaScript ">
<!--
if(self == top) location= '/member/ '
parent.username= 'user1 ';
parent.maxcredit= '1 ';
parent.uid= '3829d926m916347l476 ';
// -->
window.defaultStatus= "Wellcome................. "
</script>
</head>
<body
bgcolor= "#FFFFFF " onLoad= "onLoad(); " onUnLoad= "onUnLoad() ">
<img id=im0 width=0 height=0> <img id=im1 width=0
height=0> <img id=im2 width=0 height=0> <img id=im3 width=0 height=0> <img id=im4 width=0 height=0>
<img id=im5 width=0
height=0> <img id=im6 width=0 height=0>
</body>
</html>
Message body has been unpacked.
使用XMLHTTPClass 和 HttpWebRequest 不能获得相应数据
每次都返回“” 其他没有 if(self == top) location= '/member/ ' 这条语句的页面是可以获得具体信息的,因为该页面是放在一个frame 中,请问这样的话 有办法解决吗
------解决方案--------------------使用HttpWebRequest 可以的,你把代码贴出来
------解决方案-------------------- private string GetContentFromUrll(string _requestUrl)
{
string _StrResponse = " ";
HttpWebRequest _WebRequest = ( HttpWebRequest )WebRequest.Create( _requestUrl );
_WebRequest.Method = "GET ";
WebResponse _WebResponse = _WebRequest.GetResponse();
StreamReader _ResponseStream = new StreamReader( _WebResponse.GetResponseStream(), System.Text.Encoding.GetEncoding( "gb2312 "));
_StrResponse = _ResponseStream.ReadToEnd();
_WebResponse.Close();
_ResponseStream.Close();
return _StrResponse;
}
------解决方案--------------------学习,学习!
------解决方案--------------------使用HttpWebRequest试一试
有好多和LZ冒似的贴,你找找