I want to send the code and name variables by POST to a web service in php, I have this code in Delphi 10.4:
RESTRequest1.ClearBody;
//RESTRequest1.Body.Add... aquí iría lo del pase de parámetros
RESTRequest1.Method:= rmPOST;
RESTRequest1.Execute;
The idea is to receive it in php like this:
$codigo=isset($_POST['codigo']) ? $_POST['codigo'] : NULL;
$nombre=isset($_POST['nombre']) ? $_POST['nombre'] : NULL;
and thus be able to use that data sent.
another way would be to first build a JSON to pass it, I also did that like this:
content:='{'+
' "usuario": "'+usuario+'",'+
' "pass": "'+pass+'"'+
'}';
RESTRequest1.ClearBody;
RESTRequest1.Body.Add(content, TRESTContentType.ctAPPLICATION_JSON);
RESTRequest1.Method:= rmPOST;
RESTRequest1.Execute;
but content is just a set of data, that variable does not have a name so in php I cannot find the way to obtain it and use it can be in both ways, the first seems more practical to me but either of the two works for me. I am using Delphi RAD studio community edition 10.4