http://www.live888cn.com/ft/ftGqViewAction!showFtGq.shtml
在浏览器中打开,可以看到内容,但是用post或者get方法就返回空(这两个方法应该没有问题,其他网页可以返回结果)。
用webbrowser也看不到内容。
Remote Address:27.98.207.137:80
Request URL:http://www.live888cn.com/ft/ftGqViewAction!showFtGq.shtml
Request Method:GET
Status Code:200 OK
Response Headers
view source
Connection:close
Content-Encoding:gzip
Content-Language:zh-CN
Content-Type:text/html;charset=UTF-8
Date:Sun, 26 Apr 2015 08:25:17 GMT
Server:Apache-Coyote/1.1
Transfer-Encoding:chunked
Vary:Accept-Encoding
Request Headers
view source
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding:gzip, deflate, lzma, sdch
Accept-Language:zh-CN,zh;q=0.8
Cache-Control:max-age=0
Connection:keep-alive
Cookie:JSESSIONID=59B241080263B6D3BE85F9856C77ED31
Host:www.live888cn.com
User-Agent:Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36 OPR/28.0.1750.51
这个是抓包得到的数据,直接用WebRequest 也不行,但是我用GetHtml可以获取其他网页的数据
public static string GetHtml(string URL)
{
WebRequest wrt;
wrt = WebRequest.Create(URL);
wrt.Credentials = CredentialCache.DefaultCredentials;
WebResponse wrp;
wrp = wrt.GetResponse();
string html = new StreamReader(wrp.GetResponseStream(), Encoding.UTF8).ReadToEnd();
return html;
}
public static string GetHtml(string URL) { WebRequest wrt; wrt = WebRequest.Create(URL); wrt.Headers.Add("Cookie:JSESSIONID=B9543CFB75688E73A34D4C1E8A9F7BD0##########"); wrt.Credentials = CredentialCache.DefaultCredentials; WebResponse wrp; wrp = wrt.GetResponse(); string html = new StreamReader(wrp.GetResponseStream(), Encoding.UTF8).ReadToEnd(); return html; }
把浏览器中打开时发送的头信息抄下来
在发http请求时模拟的发送这些头信息