我现在有以下命令行脚本:
df -h | curl -F stuff=test http://foo.com
这将向 foo.com 发送 POST 请求。在 $_POST
变量中,我有以下数据集:
[stuff] => test
现在我想用 df -h
的输出更改 test
,这样我就可以在我的 $_POST
变量中看到它。
我该怎么做?
最佳答案
您可以使用xargs
df -h | xargs -I % curl -F stuff=% http://foo.com
关于php - 通过curl发送终端调用的输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33084819/