Jump to content

How to get a cURL POST?


ZigZig

Recommended Posts

Hi,

Some guy tries to send me data via this kind of cURL request (created from FileMaker Pro):

Insert from URL [ Select ; With dialog: Off : $reply ; env ( "host") ; cURL options: "-X POST -H" & Quote ( "Content-Type: text/plain" ) & " -d " & Quote ( $body ) ]

I need to get the content of  "$body", I tried with onHTTPCommand but I'm really a newbie in this matter.

Could someone explain to me how I can manage this stuff?

 

Thank you VERY much!

Link to comment
Share on other sites

Hi,

A friend gave me the answer:

procedure TUniServerModule.UniGUIServerModuleHTTPCommand(
  ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo;
  var Handled: Boolean);
begin
  try
    if (ARequestInfo.PostStream <>nil) then aRequestContent:=ReadStringFromStream(ARequestInfo.PostStream)
    else aRequestContent:='nil';
    
    // DO WHAT YOU NEED WITH aRequestContent
    
    AResponseInfo.ResponseNo := 200;
    Handled := True;
  except
    AResponseInfo.ResponseNo := 400;
  end;
end;

It works just fine!

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...