Libraries: Http Client

 

Http Client:

Work with any http servers...

Author: JDA

 


What does it mean ?

How to use this?

What is it?

 
puncher:


What does it mean ?

How to use this?

What is it?

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.

THANKS!!

 

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?

 

Hi,

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 [0][2];
   //params[?,0] = Key
   //params[?,1] = Value
   ArrayResize( params, 0); // Flush old data
   int status[1];           // 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)
   addParam("Bid",Bid,params);
   addParam("Ask",Ask,params);
   // TODO .... any other parameters
   //create URLEncoded string from parameters array
   string req = ArrayEncode(params);
   //Send Request 
   string res = httpGET("http://localhost/mql4Http/Default.aspx?", status);
   res = httpPOST("http://localhost/mql4Http/Default.aspx?", req, status);
   
   Print("HTTP:",status[0]," ", res);

additionally

http51.mq4 cannot be compiled without removing brackets and dots after function/procedure declaration. Original code doesn't compile. The following compiles.

#import "http51.dll"
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) ;
 
The http51.zip contains necessary MQL4 source files.
 
JavaDev:
The http51.zip contains necessary MQL4 source files.

great job !!

thanks.

now i can write EAs and Remote functions in php

well done.

all other examples of http posted here in the libraries doesnt work.

your code is excellent


thank you and regards from germany

 
JT2008:

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.

Hi,

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

 
JT2008:

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.

hi anyone have any example server code? one that replies to this http call?

for example, a sample servlet or jsp, or php......etc.?

Reason: