Download MetaTrader 5
To add comments, please log in or register
Find out how to add a video in the messages editor
MetaQuotes Software Corp.
Moderator
178234
MetaQuotes Software Corp. 2008.09.27 09:22 

Http Client:

Work with any http servers...

Author: JDA

Piotr
1247
Piotr 2008.09.27 18:07  


What does it mean ?

How to use this?

What is it?

JDA
585
JDA 2008.09.28 09:50  
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...


 

MQL4 Comments
16309
MQL4 Comments 2008.10.13 09:33  

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!!

MQL4 Comments
16309
MQL4 Comments 2009.01.20 14:19  

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.

Salt Cafe
28
Salt Cafe 2009.05.04 12:54  

Would you be able to submit the code to the http51.dll file?

MQL4 Comments
16309
MQL4 Comments 2009.09.12 12:36  

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) ;
JDA
585
JDA 2009.10.22 04:42  
The http51.zip contains necessary MQL4 source files.
meikel
364
meikel 2009.10.31 21:12  
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

Jesus Angeles
374
Jesus Angeles 2009.12.11 11:11  
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

Jesus Angeles
374
Jesus Angeles 2009.12.11 11:17  
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.?

/ /123
To add comments, please log in or register