I want to send the output of uptime
and df
commands to a web app using cURL. I tried:
uptime | curl http://someurl.com -T -
But that didn't seem to send the data.
What is the proper way to send the output of a command to cURL as a POST parameter? (or wget if that's much easier)
You can use the -d option in curl with a @- argument to accept input from a pipe. You will need to construct the key-value pairs yourself. Try this:
The backticks (`) denote that the enclosed command (in this case uptime) should be executed, and the backtick-quoted text replaced with the output of the executed command.