Custom Code / Custom Block /HTTP
-
Hi All,
I checked through the fxdreema forum and couldn't find anwer's to this.
Basically i want to send web request in plain text format. So i didnt know how to do this within fxdreema as each request i sent was always incorrect format. I watched few youtube videos online managed to create below mql5 syntax which works on its own in MT5.
However ideally i want to know how i can send below using web request block or if someone can help me convert the below to custom mql5 code or explain how i can create a custom block and use it that way.
Any help or guide to even convert the below to custom mql5 or custom block will be appreciated. Ideally would be great if i can use the existing send http block
input string BASE_URL = "https://"; input string Syntax_Info = "ENTER Syntax"; int OnInit(){ execute(); return(INIT_SUCCEEDED); } int execute(){ char post[], result[]; string headers = "Content-Type: text/plain\r\n"; StringToCharArray(Syntax_Info,post,0,StringLen(Syntax_Info)); int res = WebRequest("POST",BASE_URL,headers,5000,post,result,headers); return res; }Thanks in advance
-
This is a question for jstap or roar. I hope they can help.
-
In FX things work a little differently, although you can use code, much is already inside so you cannot add again, on init is all done on the on init tab, arrays although they work need to be set up separately, execute would be completed without execute() when everything. You will need has been populated
input string BASE_URL = "https://";
input string Syntax_Info = "ENTER Syntax"; THESE LINES WOULD NEED DELETING, AND STRING VARIABLES CREATING WITH THESE NAMESint OnInit(){
execute();
return(INIT_SUCCEEDED); THESE LINES NEED DELETING
}int execute(){
char post[], result[];
string headers = "Content-Type: text/plain\r\n";
StringToCharArray(Syntax_Info,post,0,StringLen(Syntax_Info));
int res = WebRequest("POST",BASE_URL,headers,5000,post,result,headers); THIS WOULD NEED TO BE DELETED AND RECREATED AS A SEPARATE ARRAYreturn res; DELETE THIS
} -
@jstap thanks for your reply.
i just dont understand how i would execute this part
int res = WebRequest("POST",BASE_URL,headers,5000,post,result,headers); THIS WOULD NEED TO BE DELETED AND RECREATED AS A SEPARATE ARRAY
any help on how to do this would be great.
-
You will have to learn arrays, I am not great at them either. Create an array then fill it
-
@fxDreema are you able to help with the above by any chance?
-
This is now resolved. Thanks everyone helping
-
What did you do to resolve it?