MFC HTTP

    CInternetSession m_winet(NULL,1,INTERNET_OPEN_TYPE_DIRECT,NULL,NULL,0);    
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,0,
(LPVOID)(LPCTSTR)str, str.GetLength());

 

#include <afxinet.h>

 

posted @ 2016-06-20 16:39  Ali.Blacken  阅读(332)  评论(0编辑  收藏  举报