KhorneHoly
KhorneHoly

Reputation: 4766

Send output from terminal call via curl

I have the following command line script right now:

df -h | curl -F stuff=test http://foo.com

Which will send an POST Request to foo.com. In the $_POST variable I have the following data set:

[stuff] => test

Now I want to change test with the output from df -h so I can see it in my $_POST variable.

How can I do this?

Upvotes: 2

Views: 95

Answers (2)

AlVaz
AlVaz

Reputation: 766

What have you tried? This might accomplish the goal. Try it out and let me know.

curl -F "stuff=`df -h`" http://foo.com

Upvotes: 2

Pedro Lobito
Pedro Lobito

Reputation: 99041

You can use xargs

df -h | xargs -I % curl -F stuff=% http://foo.com

Upvotes: 3

Related Questions