Shalem
Shalem

Reputation: 1536

Sending Request using HTTPS in C++

My C++ application consists of posting out through an HTTP connection directly to the Weblogic App server. Need to change it to post using HTTPS.

*Im running this application through Visual Studio. *

Any kind of suggestions are welcome. Coding updates are most helpful

The below is the code i have for HTTP connectivity works fine.

What i need to do it to work with HTTPS?

      strFormData = sFile;

strHeaders  = _T("Content-Type: application/x-www-form-urlencoded");

CInternetSession session;
CHttpConnection* pConnection =  session.GetHttpConnection(_T(Server), Port);

CHttpFile* pFile =  pConnection->OpenRequest(CHttpConnection::HTTP_VERB_POST,   _T(Action));                

result = pFile->SendRequest(strHeaders,(LPVOID)(LPCTSTR)strFormData,  
                                          Data.GetLength());

Upvotes: 5

Views: 8869

Answers (1)

Shalem
Shalem

Reputation: 1536

CHttpFile* pFile = pConnection->OpenRequest(CHttpConnection::HTTP_VERB_POST, _T(Action), NULL, 1, NULL, NULL, INTERNET_FLAG_SECURE);

I tried this code and it worked out for HTTPS posting. I found that parametric values (Internet secure flag) varies with HTTP & HTTPS posting.

Upvotes: 7

Related Questions