C++ 模拟用户登录,发送post包
如何模拟用户登录并且获取用户登录后的信息??
我用抓包工具抓了post的包,写程序发送过去不能得到登录后的页面~~~
post 包如下:
(Request-Line):POST /toploginnew.asp?action=login HTTP/1.1Accept:*/*Referer:http://www.microbell.com/toploginnew.aspAccept-Language:zh-cnContent-Type:application/x-www-form-urlencodedAccept-Encoding:gzip, deflateUser-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.comContent-Length:56Connection:Keep-AliveCache-Control:no-cacheCookie: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;