Download MetaTrader 5

Libraries: HTTP requests for new MQL4 (tested in build 600)

To add comments, please log in or register
MetaQuotes Software Corp.
MetaQuotes Software Corp. 2014.02.12 14:44 

HTTP requests for new MQL4 (tested in build 600):

Simple library that allows sending requests via HTTP protocol from new MQL4

Author: Sergey

Mark Norris
Mark Norris 2014.05.26 03:57  

I'm finding that this is cacheing some http_get requests so that the the GET request is not even sent and old data is returned. For example if I did:


http_result = httpGET("url.php");


Where url.php consisted of <?php echo 'hello'; ?>


then http_result would output 'hello' as you would expect. But then if I edit url.php to <?php echo 'goodbye'; ?> and save the changes then call


http_result = httpGET("url.php");


Then http_result still outputs 'hello' instead of 'goodbye'. I'm attempting to avoid this by adding "url.php?t=",TimeSeconds(TimeCurrent()) to the end of the url but this might be a memory leak if the code is cacheing return results.


Mark Norris
Mark Norris 2014.05.26 04:04  

Adding to my comment above, I found the following flags in wininet.dll that appear relevant but do not know how to implement them in your code:

INTERNET_FLAG_NO_CACHE_WRITE - does not cache the returned result

INTERNET_FLAG_RELOAD  -forces a download of the file, even if it is already in cache 


Any help would be appreciated. 


Mark Norris
Mark Norris 2014.05.26 04:27  

Ok, the following changes worked for me:

 In the #import part:


#import "wininet.dll"

#define INTERNET_FLAG_PRAGMA_NOCACHE    0x00000100 // Forces the request to be resolved by the origin server, even if a cached copy exists on the proxy.

#define INTERNET_FLAG_NO_CACHE_WRITE    0x04000000 // Does not add the returned entity to the cache. 

#define INTERNET_FLAG_RELOAD            0x80000000 // Forces a download of the requested file, object, or directory listing from the origin server, not from the cache. 




In the httpGET function:

int response = InternetOpenUrlW(handler, strUrl,"",0, INTERNET_FLAG_NO_CACHE_WRITE |



marquez 2016.08.15 06:25  

This is a good, and still working Library.


Has someone a solution how to increase or setup the timeout for the response ? 

To add comments, please log in or register