What is the reason for error in web request. Error code=4006

 
it says 

4006

ERR_NO_MEMORY_FOR_PARAM_STRING

No memory for parameter string

how to resolve it ? the below code was working fine yesterday. today morning sending error codes.


  string url="https://api.telegram.org/bot"+token+"/getUpdates";
               char result[];
               char data[];
               string headers;//="Content-Type:text/html; charset=utf-8\r\n";
               string result_headers=NULL;
                int res=WebRequest("GET",url,headers,5000,data,result,result_headers);
 if(res==-1)
     {        Print("Error in WebRequest. Error code  =",GetLastError()); }
               txt=CharArrayToString(result);
 
Balachandran Chandrasekar:
it says 

4006

ERR_NO_MEMORY_FOR_PARAM_STRING

No memory for parameter string

how to resolve it ? the below code was working fine yesterday. today morning sending error codes.


nobody there to help me out ?

 
Have you tested or tried to reproduce the request/result with wget/curl utility?

Maybe the server response is flawed and that's where the error comes from?


 
Balachandran Chandrasekar:
it says 

4006

ERR_NO_MEMORY_FOR_PARAM_STRING

No memory for parameter string

how to resolve it ? the below code was working fine yesterday. today morning sending error codes.


Is it a mql4 question ? In such case use the appropriate forum section.

 
Alain Verleyen:

Is it a mql4 question ? In such case use the appropriate forum section.

mql5 question it is.

 
  1. Balachandran Chandrasekar: mql5 question it is.

    Perhaps you should read the manual. Runtime Errors - Codes of Errors and Warnings - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
       How To Ask Questions The Smart Way. (2004
          How To Interpret Answers.
             RTFM and STFW: How To Tell You've Seriously Screwed Up.

    Constant Code Description
    ERR_INVALID_ARRAY 4006 Array of a wrong type, wrong size, or a damaged object of a dynamic array

  2. string result_headers=NULL;

    Perhaps drop the NULL

 
Gholamhossein Eslamizadeh #: Questions never get answers in this forum!!!!

The question was answered or did you not even bother to read the post just before yours?

Besides, the OP didn't follow up, so we will never know what the true situation was.

 

It had nothing to do with "Array of a wrong type, wrong size, or a damaged object of a dynamic array" neither with "No memory for parameter string".
Unlike MT4 which only get minor updates, MT5 has been developed for few years without existence of SERVICE DESK and this is why it has many MANY of those silly errors fly under a radar. (just posted about another one yesterday - can't use proxy server with mt5! no solution there yet).

The problem is... the address wasn't either added to allowed addresses for WebRequest in options or the address was incomplete like: https://api.telegram instead of  https://api.telegram.org (that was my problem - this kind of incomplete address masks are working fine in MT4, but not in MT5). You can replicate this by trying to access address with WebRequest that is not in the list or IP is incomplete - you will get 4006 error. (checked with IPs, not sure about DNS names)

Thank you MQ for wasting 3 hours of my time investigating this. I would have wasted many more if not for luck and actually getting it working by accident under other terminal. (full IP address there in allowed urls)

If we had Service Desk still and not had to spam forum with these bugs, that get under investigated or ignored - otherwise this would have been fixed long time ago by the devs. Removal of Service Desk was a dark day for Metatrader. You could at least leave it for market sellers (devs), if you were spammed by normies with useless reports.

 
Grzegorz Korycki #:

It had nothing to do with "Array of a wrong type, wrong size, or a damaged object of a dynamic array" neither with "No memory for parameter string".
Unlike MT4 which only get minor updates, MT5 has been developed for few years without existence of SERVICE DESK and this is why it has many MANY of those silly errors fly under a radar. (just posted about another one yesterday - can't use proxy server with mt5! no solution there yet).

The problem is... the address wasn't either added to allowed addresses for WebRequest in options or the address was incomplete like: https://api.telegram instead of  https://api.telegram.org (that was my problem - this kind of incomplete address masks are working fine in MT4, but not in MT5). You can replicate this by trying to access address with WebRequest that is not in the list or IP is incomplete - you will get 4006 error. (checked with IPs, not sure about DNS names)

Thank you MQ for wasting 3 hours of my time investigating this. I would have wasted many more if not for luck and actually getting it working by accident under other terminal. (full IP address there in allowed urls)

If we had Service Desk still and not had to spam forum with these bugs, that get under investigated or ignored - otherwise this would have been fixed long time ago by the devs. Removal of Service Desk was a dark day for Metatrader. You could at least leave it for market sellers (devs), if you were spammed by normies with useless reports.

This was the reason for me!

Reason: