Last active
December 23, 2021 13:36
-
-
Save syusuke9999/feebe00f4ddf5b40459d28a24f0a33ab to your computer and use it in GitHub Desktop.
POST LINE Notify request from MQL4 or MQL5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void POST_LINE_Message_To_Server(string message) | |
{ | |
char message_data[], result[]; | |
string RequestMethod = "POST"; | |
string headers = "Content-Type: application/x-www-form-urlencoded" + "\r\n"; | |
headers += "Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + "\r\n"; | |
int timeout = 10000; | |
string result_headers = NULL; | |
string message_text = "message="; | |
message_text += message; | |
StringToCharArray(message_text,message_data,0, StringLen(message_text)); | |
int res = WebRequest(RequestMethod, END_POINT_URL, headers, timeout, message_data, result, result_headers); | |
if(res==-1) | |
{ | |
Print("Error in WebRequest. Error code =",GetLastError()); | |
} | |
else | |
{ | |
string result_text = StringConcatenate(CharArrayToString(result,0,ArraySize(result))); | |
int replaced = StringReplace(result_text,"\"",""); | |
} | |
return; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment