InternetPostRequest function issue

Hi, I'm working on a simple function that send a message to the discord channel via WebHook.
I have test the request with curl and postman, they all give correct response.
But when I'm using the function from AFL, it always returns 400 status. I don't know what's wrong, I search in this forum, and find a old post mentioned that even the url is https, the function still sending it via port 80. (RFC: InternetPostRequest - #17 by bkonia)
And I tried the solution he mentioned: create a customized object then it works!
Here is the code, I comment out the code that working, BTW.

WebHookUrl = "";
InternetSetHeaders("ContentType:content-type: application/json");
postparams = "{\"user\":\"bot\",\"content\":\"hello\"}";

//objXmlHttpMain = CreateObject("Msxml2.ServerXMLHttp.6.0");
//"POST", webHookUrl, False);
//objXmlHttpMain.setRequestHeader("Content-Type", "application/json");
//response = objXmlHttpMain.responseText;
//printf("%s", response);

InternetPostRequest(WebHookUrl, postparams);
1 Like

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.