06-25-2020, 05:03 PM
Hello,
I want to get the post value that I send in html with delphi. I am using idHTTPServer. My goal is to get the data sent by POST. But there is a problem. I send it as "form-data" with a tool like the picture below. Capturing the POST request. Unfortunately, when I make the same request as HTML, it doesn't see POST. How do I achieve this?
HTML POST Request (Delphi doesn't see that request. My goal is to get that wish.)
It captures POST, which is in form-data format.
but does not see the POST request sent via HTML.
I want to get the post value that I send in html with delphi. I am using idHTTPServer. My goal is to get the data sent by POST. But there is a problem. I send it as "form-data" with a tool like the picture below. Capturing the POST request. Unfortunately, when I make the same request as HTML, it doesn't see POST. How do I achieve this?
Code:
procedure TForm1.serviceCommandGet(AContext: TIdContext;
ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
var
receiveStream: TStream;
begin
if ARequestInfo.URI = '/test.php' then
begin
if ARequestInfo.Command = 'POST' then
begin
receiveStream := ARequestInfo.PostStream;
if Assigned(receiveStream) then
begin
LOG.Lines.Add(ReadStringFromStream(receiveStream));
end;
AResponseInfo.ResponseNo := 200;
end;
end;
end;
HTML POST Request (Delphi doesn't see that request. My goal is to get that wish.)
Code:
<form method="post" action="http://localhost:99/test.php">
<input type="hidden" name="test" value="04545">
<input type="submit" value="send"/>
</form>
It captures POST, which is in form-data format.
but does not see the POST request sent via HTML.