|
1金钱
本人菜鸟一只,最近在学习post登录,但是没有一个登陆上去的...而且我不太明白到底怎么样算登陆成功了...不废话,我抓的包:
- Request URL:
https://www.appannie.com/account/login/
- Request Method:
POST
- Status Code:
302 FOUND
- Request Headersview source
- Accept:
text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
- Accept-Encoding:
gzip,deflate,sdch
- Accept-Language:
zh-CN,zh;q=0.8
- Cache-Control:
max-age=0
- Connection:
keep-alive
- Content-Length:
117
- Content-Type:
application/x-www-form-urlencoded
- Cookie:
km_lv=x; __atuvc=1%7C5%2C5%7C6; km_ai=xlfdlihailong%40126.com; km_ni=xlfdlihailong%40126.com; csrftoken=98a512880b41c1966fef7a256da751e2; secure_sessionId="gAJ9cQFVD3Nlc3Npb25fZW5hYmxlZHECSwFzLg:1YKRAD:USJAO2wufew6EUQqKqGw2ObgMgg"; sessionId="gAJ9cQFVD3Nlc3Npb25fZW5hYmxlZHECSwFzLg:1YKRAD:U1UQ-PlgDvj2t9jl_yYrJbotaXw"; __utma=143309285.1355184750.1423062380.1423330196.1423399223.7; __utmb=143309285.1.10.1423399223; __utmc=143309285; __utmz=143309285.1423062380.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utmv=143309285.|2=UserID=404171=1; kvcd=1423399223803; km_vs=1; km_uq=
- Host:
www.appannie.com
- Origin:
https://www.appannie.com
- Referer:
https://www.appannie.com/account/login/
- User-Agent:
Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36
- Form Dataview sourceview URL encoded
- csrfmiddlewaretoken:
98a512880b41c1966fef7a256da751e2
- next:
/
- username:
xlfdlihailong@126.com
- password:
xlfd460089744
- Response Headersview source
- Connection:
keep-alive
- Content-Encoding:
gzip
- Content-Length:
20
- Content-Type:
text/html; charset=utf-8
- Date:
Sun, 08 Feb 2015 12:40:51 GMT
- Keep-Alive:
timeout=60
- Location:
https://www.appannie.com/
- Server:
nginx
- Set-Cookie:
secure_sessionId=".eJxNi0tOw0AQRGOTDwyJ8jkFsLA4A1mRCBZRej1qz7Tkkc047W4TBSkSKySuwzW4VEgUELV6qqr3nu45uYGpkEio44YaCaIUldNPGJ1bK4qN8sUygZHFVgvbCjU2eO4uvu_6HRj_HiliXpFfptBF-dl7zzD7Z-ToSoqe-3C_pRwjVjsNTjJ0rm6jZnMUeoxCUYKGV3qqPVUPZ2cAE6yoUesKcqXV8EJ86TwqHdH8AV-BGXwlSecUt9npm7Gwnhs2tyu-_ljxsM0O5spVRw:1YKRAR:FV6efEpC2M56MhD3Y2en_cDeklM"; httponly; Path=/; secure
- Set-Cookie:
sessionId=".eJxNi01OAkEQRpkBQVon_JxCWEw8g6yEyIJQ605NdyV0GHuoqRoJJiauTLyO1-BSKEHjt3r58t57-sbJHYyEREIVd1RLEKWonH5CdnmtKNbK7UUCmcVGN7YRqm3w3Jkfp90WDH5FiliU5PlqkUIH5dvoLmH8rynQbSl67sH9ngqMWB40OMnRuaqJms9Q6DEKRQkaXuip8lQ-XJprGGJJtVq3Ibe1Gp6J-86j0g-aP2ADpveVJK3z3O6gr8bCemb4ZrLi248VZ01-AnHoVcU:1YKRAR:RQtcaIwwQPhaXUlzg67D6Wm5wFw"; httponly; Path=/
- Set-Cookie:
aa_user_token=".eJxrYKotZNQI5SxNLqmIz0gszihkClVINTBOszA1NbNMSk1JMjcwSjZOMTRNTTNITE1NNUlLMg8Vik8sLcmILy1OLYpPSkzOTs1LKWQONShPTUrMS8ypLMlMLtZLTE7OL80r0XNOLE71zCtOzSvOLMksS_XNT0nNcYLqYQnlRTIpM6WQ1eu0FhtDqR4AEHo0ZQ:1YKRAR:EMkLazPE4iLOzjAY_FH1XNhhItQ"; Domain=.appannie.com; httponly; Path=/
- Vary:
Cookie,Accept-Encoding
- X-Frame-Options:
SAMEORIGIN
然后是我的代码:(点击事件里的)
HttpHelper http = new HttpHelper();
HttpItem item = new HttpItem()
{
URL = "https://www.appannie.com/account/login/",//URL 必需项
Method = "POST",//URL 可选项 默认为Get
Timeout = 100000,//连接超时时间 可选项默认为100000
ReadWriteTimeout = 30000,//写入Post数据超时时间 可选项默认为30000
IsToLower = false,//得到的HTML代码是否转成小写 可选项默认转小写
Cookie = "km_lv=x; __atuvc=1%7C5%2C5%7C6; km_ai=xlfdlihailong%40126.com;" +
" km_ni=xlfdlihailong%40126.com; csrftoken=98a512880b41c1966fef7a256da751e2;" +
" secure_sessionId=\"gAJ9cQFVD3Nlc3Npb25fZW5hYmxlZHECSwFzLg:1YKRAD:USJAO2wufew6EUQqKqGw2ObgMgg\";" +
" sessionId=\"gAJ9cQFVD3Nlc3Npb25fZW5hYmxlZHECSwFzLg:1YKRAD:U1UQ-PlgDvj2t9jl_yYrJbotaXw\";" +
" __utma=143309285.1355184750.1423062380.1423330196.1423399223.7; __utmb=143309285.1.10.1423399223;" +
" __utmc=143309285; __utmz=143309285.1423062380.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none);" +
" __utmv=143309285.|2=UserID=404171=1; kvcd=1423399223803; km_vs=1; km_uq=",//字符串Cookie 可选项
UserAgent = "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36",//用户的浏览器类型,版本,操作系统 可选项有默认值
Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",// 可选项有默认值
ContentType = "application/x-www-form-urlencoded",//返回类型 可选项有默认值
Referer = "https://www.appannie.com/account/login/",//来源URL 可选项
Postdata = "csrfmiddlewaretoken=98a512880b41c1966fef7a256da751e2&next=/&username=xlfdlihailong@126.com&password=xlfd460089744",
//Allowautoredirect = true,
};
item.Header.Add("Accept-Encoding","gzip,deflate,sdch");
item.Header.Add("Accept-Language", "zh-CN,zh;q=0.8");
item.Header.Add("Cache-Control", "max-age=0");
//item.Header.Add("Connection", "keep-alive");
//item.Header.Add("Content-Length", "117");
//item.Header.Add("Host", "www.appannie.com");
item.Header.Add("Origin", "https://www.appannie.com");
HttpResult result = http.GetHtml(item);
string html = result.Html;
string cookie = result.Cookie;
richTextBox1.AppendText(cookie + "\n");
richTextBox1.AppendText(html + "\n");
//状态码
HttpStatusCode code = result.StatusCode;
//状态描述
string Des = result.StatusDescription;
richTextBox1.AppendText(code.ToString() + "\n");
richTextBox1.AppendText(Des + "\n");
str_save(result.Html, @"E:\res.txt");
我点了按钮之后,返回的是这个。。。
secure_sessionId=".eJxNi0tOw0AQRGOTDwyJ8jkFsLA4A1mRCBZRej1qz7Tkkc047W4TBSkSKySuwzW4VEgUELV6qqr3nu45uYGpkEio44YaCaIUldNPGJ1bK4qN8sUygZHFVgvbCjU2eO4uvu_6HRj_HiliXpFfptBF-dl7zzD7Z-ToSoqe-3C_pRwjVjsNTjJ0rm6jZnMUeoxCUYKGV3qqPVUPZ2cAE6yoUesKcqXV8EJ86TwqHdH8AV-BGXwlSecUt9npm7Gwnhs2tyu-_ljxsM0O5spVRw:1YKTFg:pEmbW6G20O6mMXRylH6Yk_CNClk"; httponly; Path=/; secure,sessionId=".eJxNi01OAkEQRpkBQVon_JxCWEw8g6yEyIJQ605NdyV0GHuoqRoJJiauTLyO1-BSKEHjt3r58t57-sbJHYyEREIVd1RLEKWonH5CdnmtKNbK7UUCmcVGN7YRqm3w3Jkfp90WDH5FiliU5PlqkUIH5dvoLmH8rynQbSl67sH9ngqMWB40OMnRuaqJms9Q6DEKRQkaXuip8lQ-XJprGGJJtVq3Ibe1Gp6J-86j0g-aP2ADpveVJK3z3O6gr8bCemb4ZrLi248VZ01-AnHoVcU:1YKTFg:5LbVvo_1if7yN9lxdRZ6FNoJFyc"; httponly; Path=/,aa_user_token=".eJxrYKotZNQI5SxNLqmIz0gszihkClVINTBOszA1NbNMSk1JMjcwSjZOMTRNTTNITE1NNUlLMg8Vik8sLcmILy1OLYpPSkzOTs1LKWQONShPTUrMS8ypLMlMLtZLTE7OL80r0XNOLE71zCtOzSvOLMksS_XNT0nNcYLqYQnlRTIpM6WQ1eu0FhtDqR4AEHo0ZQ:1YKTFg:dSS8ikQiIFEdGt7I85KKZ18tFkk"; Domain=.appannie.com; httponly; Path=/
Redirect
FOUND
而且没有html返回给我
到底这算登上了还是没登上?我估计是没登上吧,没登上的话到底哪里出了问题?各位大神帮帮小弟啊
|
|