How to send multiline data to curl from a script?
Bo Berglund
bo.berglund at gmail.com
Sat Sep 4 09:58:15 UTC 2021
On Sat, 4 Sep 2021 10:51:00 +0100, Peter Flynn <peter at silmaril.ie> wrote:
>On 04/09/2021 01:16, Karl Auer wrote:
>> On Fri, 2021-09-03 at 18:33 +0200, Bo Berglund wrote:
>>> When the processing is done and the user entered items have been
>>> extracted I now want to send the data via a call to a php script file
>>> on *another* webserver for final handling like storage on a private
>>> database etc.
>>
>> You could build a curl command line
>
>I'm not clear why you can't just run something like tr '\012' '\040' to
>replace all newlines with spaces, so that you pass one long, long line
>to curl. On most server platforms there is no meaningful "line length"
>limit to a URI (that is, there is a limit but it's in the thousands or
>tens of thousands of bytes).
I found the solution of that problem here:
https://en.wikipedia.org/wiki/Percent-encoding#Character_data
So by putting %0A in the line break positions the URL is still a single line but
the php script called will get a multi-line entry.
Works fine on my test from the command line curl in Ubuntu at least.
--
Bo Berglund
Developer in Sweden
More information about the ubuntu-users
mailing list