This lib for data exchange between MT4 and any HTTP Servers.
If you do not know that such HTTP - the given library is unnecessary you :) or read rfc2616 and server side programing (CGI,ASP,JSP,PHP,Perl...)
I use this library for work with Apache Tomcat & Derby DB. My friend use for integrating MT4 with Intersystems Cache Object Database...
This is cool. http is a good way of making a remote procedure call. There would be wide variety of applications using this http library.
I am thinking of writing a command dispatcher in MQL4 so that the web server can place order via MT4.
Any one can provide me an example of how a script for example in php should looks like for communicating with the sample above?
Thank you much.
Would you be able to submit the code to the http51.dll file?
I get the following error message:
"can not call function 'addparam' from dll http51.dll (error 127)"
Could you please tell me what is the problem?
My code is below: ( a little bit modified version of the original code posted with article)
string params ;
//params[?,0] = Key
//params[?,1] = Value
ArrayResize( params, 0); // Flush old data
int status; // HTTP Status code
// params[1,0]= "Bid"; params[1,1]= 100;
// params[2,0]= "Ask"; params[2,1] = 200;
// Setup parameters addParam(Key,Value,paramArray)
// TODO .... any other parameters
//create URLEncoded string from parameters array
string req = ArrayEncode(params);
string res = httpGET("http://localhost/mql4Http/Default.aspx?", status);
res = httpPOST("http://localhost/mql4Http/Default.aspx?", req, status);
Print("HTTP:",status," ", res);
http51.mq4 cannot be compiled without removing brackets and dots after function/procedure declaration. Original code doesn't compile. The following compiles.
string httpGET (string URL, int status );
string httpDELETE (string URL, int status );
string httpPUT (string URL, string RequestBody, int status );
string httpPOST (string URL, string RequestBody, int status );
string httpTRACE (string URL, string RequestBody, int status );
string URLEncode(string toCode) ;
string ArrayEncode(string &array) ;
void addParam(string key, string val, string &array);
string hex(int i) ;
great job !!
now i can write EAs and Remote functions in php
all other examples of http posted here in the libraries doesnt work.
your code is excellent
thank you and regards from germany
Anyone have an example of a server code that is called by this ?
e.g. a servlet or jsp that we can call from mql4 using this library, and will send reply
hi anyone have any example server code? one that replies to this http call?
for example, a sample servlet or jsp, or php......etc.?