Integrate with Line Notification
-
How to convert the following script to Custom MQL Code on fxDreema?
##################################################
//+------------------------------------------------------------------+
//| SendLineAlert.mq4 |
//| Copyright 2018, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2018, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
input string Token ="";
input string Massage ="Hello";int OnInit()
{
//---
string headers;
char data[], result[];headers="Authorization: Bearer "+Token+"\r\n application/x-www-form-urlencoded\r\n";
ArrayResize(data,StringToCharArray("message="+Massage,data,0,WHOLE_ARRAY,CP_UTF8)-1);
int res = WebRequest("POST", "https://notify-api.line.me/api/notify", headers, 0, data, data, headers);
if(res==-1)
{
Print("Error in WebRequest. Error code =",GetLastError());
MessageBox("Add the address 'https://notify-api.line.me' in the list of allowed URLs on tab 'Expert Advisors'","Error",MB_ICONINFORMATION);
}//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//---}
//+------------------------------------------------------------------+ -
There is a block to send web request
-
In the web request box, Where I can put "headers" to?
-
@advanceriskway What do you exactly mean by 'headers'?
-
@l-andorrà int res = WebRequest("POST", "https://notify-api.line.me/api/notify", headers, 0, data, data, headers);
I try to convert the code above to fxdreema.
-
@advanceriskway Oops. I'm afraid you will need a real programmer for that. I have no idea how to do it, sorry.