[C#] 纯文本查看 复制代码 Response Headers
Cache-Control:private
Content-Length:1479
Content-Type:application/json; charset=utf-8
Date:Fri, 23 Dec 2016 16:37:41 GMT
Request Headers
Accept:application/json, text/plain, */*
Accept-Encoding:gzip, deflate
Accept-Language:en,zh-CN;q=0.8,zh;q=0.6
c02b5:ZHltm6nMkooXhs1F3F09uHRUaIVCkRW-Awi78i7omUtmEFuunjkB1A2Nll5rjNa9cdQ7u6bBGA4wOoxwpyKp2QR6xEs1
Connection:keep-alive
Content-Length:0
Cookie:language=zh-CN; _gat=1; __RequestVerificationToken=CY8RpMMfov2XhtI1TcqExAWUOtIRb06TTxoHDE5NErEymKcbnEHOtfBgonqql9ImBJD1b46sCItWb4Z_tjYIwOuDoV41; _ga=GA1.2.1604684727.1482256331
Host:XXXX.com
Origin:[url]http://XXXX.com[/url]
Referer:[url]http://XXXX.com/Register[/url]
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.94 Safari/537.36
X-Requested-With:XMLHttpRequest
这是我针对某个网站的图片验证码抓的包,返回的数据格式是data:image/png;base64,
我在代码中的实现是
[C#] 纯文本查看 复制代码 private void GetImage()
{
item = new HttpItem()
{
URL = "http://XXXX.com/GetCaptcha",
Method = "post",
Cookie = cookie,
Accept = "application/json, text/plain, */*",
Referer = "http://XXXX.com/Register",
ResultType = ResultType.Byte,
ContentType = "application/json; charset=utf-8",
UserAgent = agent,
};
item.Header.Add("c02b5", pageToken);
item.Header.Add("Origin", "http://XXXX.com");
item.Header.Add("X-Requested-With", "XMLHttpRequest");
result = http.GetHtml(item);
richTextBox1.Text = result.Html;
//pbCode.Image = byteArrayToImage(result.ResultByte);
}
可是我在执行的时候得到的是HTTP ERROR 411的错误。求解!
[HTML] 纯文本查看 复制代码 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Length Required</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Length Required</h2>
<hr><p>HTTP Error 411. The request must be chunked or have a content length.</p>
</BODY></HTML>
|