issue with Wininet for https request in mql4

 
//+------------------------------------------------------------------+
//|                                         qjol sol for wininet.mq4 |
//|                                  Copyright 2023, MetaQuotes Ltd. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2023, MetaQuotes Ltd."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict

#import  "Wininet.dll"
   int InternetOpenW(string, int, string, string, int);
   int InternetConnectW(int, string, int, string, string, int, int, int); 
   int InternetOpenUrlW(int, string, string, int, int, int);
   int InternetReadFile(int, string, int, int& OneInt[]);
   int InternetCloseHandle(int); 
   int HttpOpenRequestA(int, string, string, string, string, string, int, int);
   bool HttpSendRequestW(int, string, int, string, int);
#import
#import "kernel32.dll"
int GetLastError(void);
#import

string token = "6mbdbqo34jbdslnfhva35c46n0";
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   string headers = "";
   string data = "";
   string Types = "";
   char acceptTypes[];
   StringToCharArray(Types, acceptTypes);
   int HttpOpen = InternetOpenW("Mozilla/5.0", 0, " ", "", 0);  
   int HttpConnect = InternetConnectW(HttpOpen, "hehehe.free.beeceptor.com", 80, "", "", 3, 0, 0);
   int HttpRequest = HttpOpenRequestA(HttpConnect, "DELETE", "", "", "", "", 0, 0);   
   bool result = HttpSendRequestW(HttpRequest, headers, StringLen(headers), data, StringLen(data));
   Alert ("Last MSDN Error =: ", kernel32::GetLastError());
   int read[1];
   Print("This is the POST result: ", result);
   InternetCloseHandle(HttpOpen);
   InternetCloseHandle(HttpRequest);
//---
   return(INIT_SUCCEEDED);
  }

Can anyone please point out what is wrong with my code, the MSDN error shows 0, I am using mock endpoint to try to see if the code works but it does not register the request when the code is executed, I have tried using port 443 for https with 0x00800000 flag for HTTPS in HttpsOpenRequestA but still does not show on the endpoint. using simple curl command sends a request while this code does not.

curl -X DELETE https://hehehe.free.beeceptor.com/

I tried using kernel32 winexec with above code but it return code 2 and does not send request to endpoint.


I would really appreciate any help Thank you!

 

Hello to anyone visiting this in future,

I solved the issue by using another DLL Function ShellExecuteW from Shell32.dll

#import "shell32.dll"
   int ShellExecuteW(int hwnd, string lpOperation, string lpFile, string lpParameters, string lpDirectory, int nShowCmd);

#import
    string batchFilePath = "C:\\Windows\\System32\\curl.exe";
    string req = "-X DELETE https://www.demo.com -H \"header\"";  
    int result = ShellExecuteW(0, "open", batchFilePath, req, "", 0);