WebRequest no communicate with API

 

hello good day, i´m trying to send some simple data from my EA in mql5 to an API. i wish send the follow string "id_ea=2&symbol=EURUSD&operation=SELL&value=1.3142" a my index.html


void Enviar()
{  
   string url="http://127.0.0.1:8080/";
   char post[];
   char result[];
   string headers;
   int res;
   string signal = "id_ea=2&symbol=EURUSD&operation=SELL&value=1.3142";
   StringToCharArray(signal,post);
   //--- reseteamos el último error
   ResetLastError();
   //--- enviamos los datos a API REST
   res=WebRequest("POST",url,NULL,NULL,50,post,ArraySize(post),result,headers);
   //--- comprobamos los errores
   if(res==-1)
   {
      Print("Código del error =",GetLastError());
      //--- es posible que URL no haya sido añadido, mostramos el mensaje para añadirlo
      MessageBox("Añadir la dirección '"+url+"' en la pestaña Expert Advisors de la ventana Options","Error",MB_ICONINFORMATION);
   }
    else
    {
       //--- con éxito
       Print("POST del cliente REST: ",signal);
       Print("Respuesta del servidor: ",CharArrayToString(result,0,-1));
    }         
}

Index.html and dataMQL5.json are creates with Atom, as show the codes below. I also use live-server for create the local server: http://127.0.0.1:8080/

I open the index.html and always show:

Hola Metatrader

  • 1 AUDUSD BUY 0.9281

the EA is running but no refresh the index.html with the string "id_ea=2&symbol=EURUSD&operation=SELL&value=1.3142".

In the expert tab, show the messages:


2020.04.09 11:55:01.878 EA11_HTTP1 (EURUSD,M1) POST del cliente REST: id_ea=2&symbol=EURUSD&operation=SELL&value=1.3142

2020.04.09 11:55:01.878 EA11_HTTP1 (EURUSD,M1) Respuesta del servidor: 


i no see answer of the server.

what need i more make for see the message of mql5 in my index.html?, please help, thanks


index.html :

<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title>JSON con Metatrader</title>
  </head>
  <body>

     <h1>Hola Metatrader</h1>
     <ul id="dataMQL5"></ul>

     <script>

        var xhttp = new XMLHttpRequest();
        xhttp.onreadystatechange = function()
        {  if (this.readyState == 4 && this.status == 200)
           {  var respuesta = JSON.parse(xhttp.responseText);
              var dataMQL5 = respuesta.dataMQL5;

              var salida = '';

              for (var i=0; i<dataMQL5.length; i++)
              { salida += '<li>' + dataMQL5[i].ea_id + "  " + dataMQL5[i].symbol + "  "
                                 + dataMQL5[i].operation + "  " + dataMQL5[i].value 
                          '</li>';
              };
              document.getElementById("dataMQL5").innerHTML = salida;

           }
        };
        xhttp.open("GET", "dataMQL5.json", true);
        xhttp.send();

     </script>

  </body>

</html>


dataMQL5.json :

{
  "dataMQL5" :
  [  { "ea_id": "1", "symbol": "AUDUSD", "operation": "BUY", "value": "0.9281" }
  ]
}