关于发送POST登陆论坛的问题。
POST /pages/login HTTP/1.1
Accept: */*
Accept-Language: zh-cn
Referer: http://www.buxfeed.com/pages/login
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)
Host: www.buxfeed.com
Content-Length: 132
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: login_rememberusername=1; login_user=aWV%2FYHt6Y3dtfQ%3D%3D; sig=20130823d3f6fb5e5c17; PHPSESSID=f2b8c1fac82aae54a4d3048892a9a7e9
以上是我抓到的登陆数据包。想问下,最下面那个COOKIE部分可以去掉么?因为我不知道如何操作COOKIE。
[解决办法]
应当可以不要。通常是登陆之后产生Cookie。
[解决办法]
如果使用的是WinHttp的话,让它自动管理cookie就好。
使用的是IdHttp的话,也可以设置自动管理。
[解决办法]
如果想自己管理cookie的话
idhttp.Request.SetHeaders;
idhttp.Request.CustomHeaders.Clear;
idhttp.Request.CustomHeaders.Add(sCookie);