Winsock 2.0 | |
Advantages | Disadvantages |
|
|
WinInet API 2.0 | |
Advantages | Disadvantages |
|
|
Figure 5 WinInetSSL.cpp
HINTERNET hSession;
hSession = InternetOpen("MyApp", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
if (hSession)
{
HINTERNET hService;
hService = InternetConnect(hSession, "aarons.axtech.com",
INTERNET_DEFAULT_HTTPS_PORT, NULL, NULL,
INTERNET_SERVICE_HTTP, 0, 0);
if (hService)
{
HINTERNET hHttpRequest;
hHttpRequest = HttpOpenRequest(hService, "POST", "sample.cgi",
NULL, NULL, NULL, INTERNET_FLAG_SECURE, 0);
if (hHttpRequest)
{
char lpData[BUFFLEN] = {"SensitiveData=0123456789"};
if (HttpSendRequest(hHttpRequest, NULL, 0, lpData, strlen(lpData)))
{
//read response
}
}
}
}
InternetCloseHandle(hSession);