VC POST编程函数模版

/*VC POST编程函数模版 */


void PostData(){


    char szBuff[MAX_PATH] ={"fastloginfield=username&username=用户名&password=密码&quickpassword=yes&handlekey=ls"} //初始化POST数据(抓包获得)

    HINTERNET hOpen = InternetOpen(NULL,INTERNET_OPEN_TYPE_DIRECT,NULL,NULL,INTERNET_FLAG_ASYNC);

    HINTERNET hConnect= InternetConnect(hOpen,"www.XXX.com",INTERNET_DEFAULT_HTTP_PORT,NULL,NULL,INTERNET_SERVICE_HTTP,NULL,NULL);

    char szAccept[MAX_PATH] = {"Accept: */*"};

    HINTERNET hReques = HttpOpenRequest(hConnect,"POST","/member.php?mod=logging&action=login&loginsubmit=yes&infloat=yes&lssubmit=yes&inajax=1",
                                        NULL,NULL,(LPCSTR*)&szAccept,INTERNET_FLAG_RELOAD,0);

    DWORD dwSendLent = sizeof(szBuff);
    BOOL bOK = HttpSendRequest(hReques,"Content-Type: application/x-www-form-urlencoded\r\n",-1,(LPVOID)szBuff,dwSendLent);

    if (bOK == TRUE)
    {
      MessageBox("成功!");
    }
}


你可能感兴趣的:(VC POST编程函数模版)