Question
How to send http request in Adobe Acrobat SDK Plugin using C++
Hello everyone.
I'm developing a simple Adobe Acrobat SDK Plugin(I started this plugin from `Sample/BasicPlugin` project). I added new menu item and custom dialog for this plugin but I faced an issue. I can't send http request to my api host. But the code works well on Windows Desktop Application project. Below is the code to send request.
HINTERNET hSession = InternetOpenA("MyCustomAPIPlugin", 0, NULL, NULL, 0);
if (!hSession) {
lastError = GetLastError();
return;
}
HINTERNET hConnect = InternetConnectA(hSession, "api.mycustom.dev",
0, 0, 0, INTERNET_SERVICE_HTTP,
0, 1);
if (!hConnect) {
lastError = GetLastError();
return;
}
HINTERNET hFile = HttpOpenRequestA(hConnect, "GET", "/api/cases",
"HTTP/1.0", 0, 0, INTERNET_FLAG_EXISTING_CONNECT, 1);
if (!hFile) {
lastError = GetLastError();
return;
}
char headers[] = "X-Api-Key: 0000-00000-00000-00000";
BOOL bRet = HttpAddRequestHeadersA(hFile, headers, static_cast<DWORD>(strlen(headers)),
HTTP_ADDREQ_FLAG_ADD_IF_NEW);
if (!bRet) {
lastError = GetLastError();
return;
}
bRet = HttpSendRequestA(hFile,
0, 0, 0, 0);
///***** In plugin, this value is FALSE but in windows desktop application project, it's TRUE.*****
if (!bRet) {
lastError = GetLastError();
return;
}
