Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Capturing HTML POST with Delphi? (Indy)
#1
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?

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>

[Image: z5dqN.png]

It captures POST, which is in form-data format.
but does not see the POST request sent via HTML.
Reply


Messages In This Thread
Capturing HTML POST with Delphi? (Indy) - by HalilHanBadem - 06-25-2020, 05:03 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)