Полазил по форуму и MSDN`у, нашёл кое-что по этому вопросу, но всё равно что-то не получается
вот код:
#include <stdio.h>
#include <conio.h>
#include <windows.h>
#include <wininet.h>
#pragma comment (lib, "Wininet.lib")
void error(char *str)
{
printf("ERROR [%d] at %s\n", GetLastError(), str);
getch();
exit(1);
}
void main()
{
DWORD flags = INTERNET_FLAG_SECURE | INTERNET_FLAG_IGNORE_CERT_DATE_INVALID | INTERNET_FLAG_IGNORE_CERT_CN_INVALID;
HINTERNET hInet = InternetOpen("agent", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
if (hInet == NULL)
error("hInet");
HINTERNET hConn = InternetConnect(hInet, "contract.solo.by", INTERNET_DEFAULT_HTTPS_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
if (hInet == NULL)
error("hInet");
HINTERNET hReq = HttpOpenRequest(hConn, "GET", "/main.asp", NULL, "", NULL, flags, 0);
if (hReq == NULL)
error("hReq");
if (!HttpSendRequest(hReq, NULL, 0, NULL, 0))
error("HttpSendRequest");
DWORD nn;
int sz = 2048;
char *buf = new char[sz];
InternetReadFile(hReq, buf, sz, &nn);
for (int i=0; i<nn; i++)
printf("%c", buf[i]);
delete buf;
InternetCloseHandle(hReq);
InternetCloseHandle(hConn);
InternetCloseHandle(hInet);
printf("end\n");
getch();
}
HttpSendRequest возвращает ошибку "The function is unfamiliar with the Certificate Authority that generated the server's certificate.". Подскажите в чём может быть проблема??