Chinaunix首页 | 论坛 | 博客
  • 博客访问: 411643
  • 博文数量: 95
  • 博客积分: 5001
  • 博客等级: 大校
  • 技术积分: 1030
  • 用 户 组: 普通用户
  • 注册时间: 2007-05-13 11:43
文章分类

全部博文(95)

文章存档

2007年(95)

我的朋友

分类: C/C++

2007-05-13 12:36:34

#include
#include
#include
int main(int argc,char **argv)
{
        char user[100];                                                              
        char password[100];
        if(argc<3||argc>3)
        {
                cout<                cout<<"login [username] [password]"<                cout<<"deafult server:202.204.48.66"<                return -1;
        }
        else
        {

                strcpy(user,argv[1]);
                strcpy(password,argv[2]);
        }
        WSADATA wsa;
        WSAStartup(MAKEWORD(1,2),&wsa);
        SOCKET sock;
        sock=socket(AF_INET,SOCK_STREAM,0);
        sockaddr_in dt;
        dt.sin_family=AF_INET;
        dt.sin_port=htons(80);
        dt.sin_addr.S_un.S_addr=inet_addr("202.204.48.66");
        int error;
    error=connect(sock,(const sockaddr*)&dt,sizeof(sockaddr_in));
    int stat;
        stat=1;
        char respone[2632];        
        memset(respone,0,2632);
    char requestpost[1000];
        sprintf(requestpost,"POST / HTTP/1.1\r\nContent-Type: application/x-www-form-urlencoded\r\nAccept-Encoding: gzip, deflate\r\nHost: 202.204.48.66\r\nContent-Length: 59\r\nDDDDD=%s&upass=%s&R=1&0MKKey=%%B5%%C7%%C2%%BC+Login\r\n",user,password);
        error=send(sock,requestpost,sizeof(requestpost),0);
        cout<    cout<<"************************************************************"<        stat=recv(sock,respone,2632,0);
        printf("%s\r\n",respone);
        return 1;

}

阅读(1064) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~