Forked from syusuke9999/POST_LINE_Message_To_Server(string message)
Created
August 3, 2020 09:05
-
-
Save tolawho/666a9417d2058c6760f08030162b9e43 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