MFC HTTP

时间:2023-01-11 20:03:06
    CInternetSession m_winet(NULL,,INTERNET_OPEN_TYPE_DIRECT,NULL,NULL,);
CHttpConnection *pConnection;
CHttpFile *pFile;
pConnection = m_winet.GetHttpConnection(L"www.9hlh.com"); CString strHeaders, tempStr,str;
str="type=1";
//strHeaders = _T("Content-Type: application/x-www-form-urlencoded"); pFile=pConnection->OpenRequest(CHttpConnection::HTTP_VERB_POST,L"/test.php");
pFile->AddRequestHeaders(L"Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */*");
pFile->AddRequestHeaders(L"User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
pFile->AddRequestHeaders(L"Content-Type: application/x-www-form-urlencoded");
pFile->SendRequest(
NULL,,
(LPVOID)(LPCTSTR)str, str.GetLength());
#include <afxinet.h>