- Unfortunately, not! Only by using DLL calls to Windows API instead. or using some intermediate web-application.
- I guess you will have to experiment and see! I've never considered doing such things with WebRequest().
Have you allowed the URL in the Options (Ctrl+O):
- Unfortunately, not! Only by using DLL calls to Windows API instead. or using some intermediate web-application.
- I guess you will have to experiment and see! I've never considered doing such things with WebRequest().
Hi Fernando -- thanks for the quick reply, as usual, albeit ultimately disappointing :-)
Just remembered a possibility — have you tried just setting "https://googleusercontent.com" in the URL list?
Maybe MetaTrader will automatically consider the "*.googleusercontent.com" sub-domains as valid.
I've never tried it before but maybe it works.
I just tried adding "https://*.googleusercontent.com" with a wildcard and it accepted it, but don't know if it actually works.
What about tiny Url: https://tinyurl.com/app/
- tinyurl.com
That will not work. It is not a fixed URL. We are talking about Google Drive here that applies load balancing by directing to different servers.
EDIT: Besides, "tinyurl" just redirects the URL to the correct one. It will suffer the same issue.
I just tried adding "https://*.googleusercontent.com" with a wildcard and it accepted it, but don't know if it actually works.
Good call on the wildcard... Just tried it, but doesn't seem to work -- it appears that the full domain name needs to be added to the allowed URL list.
int response = WebRequest("GET", web_url, headers, timeout, post_data, result_data, result_headers); int error_code = GetLastError();
The code above results in response == -1 and error_code == 4014 which, in MQL5, means "function is not allowed for call" (ERR_FUNCTION_NOT_ALLOWED), i.e. URL not found in allowed list.
- www.mql5.com
Did you try my suggestion of just using the parent domain name?
Forum on trading, automated trading systems and testing trading strategies
WebRequest(): how to handle HTTP 303 response downloading shared files from Google Drive?
Fernando Carreiro, 2022.11.23 22:24
Just remembered a possibility — have you tried just setting "https://googleusercontent.com" in the URL list?
Maybe MetaTrader will automatically consider the "*.googleusercontent.com" sub-domains as valid.
I've never tried it before but maybe it works.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello all,
Wondering if someone could point me in the right direction vis-a-vis an issue I'm facing with WebRequest() when attempting to download shared files from Google Drive, e.g. sample file linked below:
https://drive.google.com/uc?id=1-PtADmc85Tws_RcRF9nGJ0LkkBvv3DWO&export=download
Attached is the script I'm using to test this -- pretty much a straightforward "GET" request via WebRequest() call to the URL above... The issue seems to be that drive.google.com responds with HTTP 303 (See Other) which redirects to a server in a different domain (in this case doc-04-c8-docs.googleusercontent.com). So, basically, my questions are:
Here's a snapshot from the debugger after this piece of code:
Here are the full contents of the `results_headers` string for reference just in case:
Here's a snapshot from wget fetching the same URL -- ideally, I'd like if WebRequest() could handle things in the same manner 😇