我用抓包工具抓了post的包,写程序发送过去不能得到登录后的页面~~~
http://topic.csdn.net/u/20110820/17/f131a4b3-09e8-4837-bed2-aa86ada2457d.html
post 包如下:
(Request-Line):POST /toploginnew.asp?action=login HTTP/1.1 Accept:*/* Referer:http://www.microbell.com/toploginnew.asp Accept-Language:zh-cn 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; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.2) Host:www.microbell.com Content-Length:56 Connection:Keep-Alive Cache-Control:no-cache Cookie:Hm_lvt_d554f0f6d738d9e505c72769d450253d=1313830937218; Hm_lpvt_d554f0f6d738d9e505c72769d450253d=1313830937218; c=; cnzz_a1752123=0; sin1752123=; rtime=1; ltime=1313830937031; cnzz_eid=62850849-1313743537-; ASPSESSIONIDAQCDDRBT=IPKOAKFDHBBIAACOHKDIEPPD; MBname=; MBemail=; MBpermission=; MBpwd=
我的登录代码
string host = GetHost(url);
string urlPath = GetUrlPath(url);
timeval connectTime;
connectTime.tv_sec = 6;
connectTime.tv_usec = 0;
SOCKET sock;
if (!ConnectWebSite(sock, host, connectTime, path))
{
return false;
}
string POST = urlPath;
char header[1024] = {0};
sprintf(header,post的包字节);
send(sock, header, strlen(header), 0);
ReceiveStream(sock, stream, time, path);
closesocket(sock);
WSACleanup();
return true;
http://topic.csdn.net/u/20110820/17/f131a4b3-09e8-4837-bed2-aa86ada2457d.html