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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...