I testing your products for a new project.
I need to make a POST HTTP requests and send the body parameters, what is the best component or classes for it.
I see TTMSFNCRESTClient or TWebHttpRequest.
I tried to use TWebHttpRequest but don't worked for me is this code:
procedure TForm1.WebButton1Click(Sender: TObject);
begin
Req.URL := 'https://www.valery.com/consoleApp/consulta_post_objeto.php';
Req.Headers.Clear;
Req.Headers.AddPair('Content-Type', 'application/x-www-form-urlencoded');
Req.Command := httpPOST;
Req.PostData := 'q=licencias&licencia=577567325071';
Req.Execute;
end;
procedure TForm1.ReqResponse(Sender: TObject; AResponse: string);
begin
Console.log(AResponse);
Console.log(AResponse.Length)
end;
The AResponse is empty but I tested with postman and work fine.
I don't know if I passed the body parameters bad or something
Another question:
What is the unit of TTMSFNCRESTClient to put at uses section.
Please help me