I want to send a post request using the curl command with the data resulting from an execution of a script or command, in this case, the command is ifconfig. I am looking for a oneliner that can be executed in a Linux terminal or Windows CMD.
In simple words, I want to send the result of the command to the server.
Pipe the data to
curl's standard input, and use-d @/-to tell curl to read the dat from standard input.It's common for command line utilities to use
-to represent standard input. Curl is one such utility.In curl,
-d @somethingwill expect to get its data from pathsomething.So
-d @-tellscurlto get its POST data from standard input.You can then pipe the data you want to upload straight to
curl: