i am getting error 4051 mql4 using webrequest

i am getting error 4051 mql4 using webrequest

Manage alerts

Loading saved threads...

atozmax · External communityPost link
External question — Stack Overflow Stack Exchange Author: atozmax Original post: https://stackoverflow.com/questions/75544590 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. this is my code I am trying to send a PUT http request to this endpoint but Im getting error 4051 and also status code is -1 and it is not even reaching to the server. void OnStart(){ double equity = AccountInfoDouble(ACCOUNT_EQUITY); Alert("equity: ",equity); Alert("INIT_SUCCEEDED: ",INIT_SUCCEEDED); char post[], result[]; string headers ; string obj = "{\"balance\":200000,\"minimumBalance\":200000,\"equity\":200000,\"minimumEquity\":200000,\"dateTime\":\"2023-01-15T23:45:00.000Z\"}"; StringToCharArray( obj, post, 0, StringLen(obj) ); // Must specify string length; int res = WebRequest( "PUT", "http://localhost:8000/api/user/add-equity-balance/1", "", NULL, 10000, post, ArraySize( post ), result, headers ); Alert( "Status code: " , res, ", error: ", GetLastError() ); Alert( "Server response: ", CharArrayToString( result ) ); Alert("Server headers: ", headers); } I just need to send this PUT request
Quote
Report
Yasin İPEK · External communityPost link
External answer — Stack Overflow Stack Exchange Author: Yasin İPEK Original post: https://stackoverflow.com/a/75757466 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. //+------------------------------------------------------------------+ //| aads.mq4 | //| Copyright 2023, MetaQuotes Ltd. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2023, MetaQuotes Ltd." #property link "https://www.mql5.com" #property version "1.00" #property strict input string mesaj="deneme"; input string sunucuAdres="http://deneme.ipekbilgisayar.org"; //Internet Adres //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { //--- CagriGonder(mesaj); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void CagriGonder(string Mesaj) { string cookie=NULL,headers; char post[],result[]; string header="Content-Type: application/text"; StringToCharArray(Mesaj,post,0,StringLen(Mesaj)); ResetLastError(); int timeout=20000; int res=WebRequest("POST",sunucuAdres,header,timeout,post,result,headers); Print(CharArrayToString(result)); } //+------------------------------------------------------------------+ Example
Quote
Report

Post Reply

Quoted from Forex.com.bd-Editorial External answer — Stack Overflow Stack Exchange Author: Yasin İPEK Source score (net votes, not local likes): 1 Original post: https://stackoverflow.com/a/75757466 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. //+------------------------------------------------------------------+ //| aads.mq4 | //| Copyright 2023, MetaQuotes Ltd. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2023, MetaQuotes Ltd." #property link "https://www.mql5.com" #property version "1.00" #property strict input string mesaj="deneme"; input string sunucuAdres="http://deneme.ipekbilgisayar.org"; //Internet Adres //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { //--- CagriGonder(mesaj); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void CagriGonder(string Mesaj) { string cookie=NULL,headers; char post[],result[]; string header="Content-Type: application/text"; StringToCharArray(Mesaj,post,0,StringLen(Mesaj)); ResetLastError(); int timeout=20000; int res=WebRequest("POST",sunucuAdres,header,timeout,post,result,headers); Print(CharArrayToString(result)); } //+------------------------------------------------------------------+ Example

Cancel quote

Checking account access…