18,356
社区成员
发帖
与我相关
我的任务
分享
(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;
#include <cstdio>
#include <curl.h>
#include <cstring>
#include <cstdlib>
#include <types.h>
#include <easy.h>
#pragma comment(lib,"libcurl_imp.lib")
int main()
{
curl_global_init(CURL_GLOBAL_ALL);
CURL *myHandle=curl_easy_init();
curl_easy_setopt(myHandle,CURLOPT_USERAGENT,"Mozilla/4.0");
curl_easy_setopt(myHandle,CURLOPT_AUTOREFERER,1);
curl_easy_setopt(myHandle,CURLOPT_FOLLOWLOCATION,1);
curl_easy_setopt(myHandle,CURLOPT_COOKIEFILE,"");
curl_easy_setopt(myHandle,CURLOPT_URL,"http://www.3322.org/dyndns/login");
curl_easy_perform(myHandle);
char *data="username=xxxxxx&actiong=login&password=xxxxxxxxx&submit=%E7%99%BB%E5%BD%95&action=login";
char *update="hostname=xxxx&myip=192.168.1.1&mx=&backmx=NO&wildcard=OFF&offline=NO&act=mod&modflag=modflag";
curl_easy_setopt(myHandle,CURLOPT_POSTFIELDS,data);
curl_easy_perform(myHandle);
curl_easy_setopt(myHandle,CURLOPT_URL,"http://www.3322.org/dyndns/chrrs");
curl_easy_setopt(myHandle,CURLOPT_POSTFIELDS,update);
curl_easy_perform(myHandle);
curl_easy_cleanup(myHandle);
return 0;
}