I've already used the native WebRequest()
function to POST
data.
Usually I post data using these lines below
// **********
char dataUpdatePost[];
char dataUpdateResult[];
string dataUpdateStr = "dataUpdateFlag=YES&orderNumber=" + orderNumber + "&profit=" + profit + "&profitPips=" + profitPips + "&cookie=" + sessionID;
ArrayResize(dataUpdatePost, StringToCharArray(dat[0,1], dataUpdatePost, 0, WHOLE_ARRAY, CP_UTF8) - 1);
ResetLastError();
int updateDataRes = WebRequest( "POST",
"http://service.jumpinvestor.com/",
"",
NULL,
1,
dataUpdatePost,
0,
dataUpdateResult,
dataUpdateHeaders
);
// **********
and it works fine ...
but this I would like to send an array like this.
string dat[3][10];
Is there a way in MQL4
to send it via WebRequest()
?
Thank you in advance.
JSON: The best way is to convert (serialize) your array into a JSON string, and send it over, with the WebRequest()
. JSON is widely accepted format and chances are your web-application is able to parse (deserialize) them out of the box.
The downside is that you will need to write a serializer for it.
So far, I've only come across one MQL4 serializer:
https://www.mql5.com/en/code/11134
Good luck!