php - 通过curl发送终端调用的输出

标签 php curl terminal

我现在有以下命令行脚本:

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/

相关文章:

php - 从 Couchdb 返回用户特定数据

php - 从 SonataAdmin 中的表单访问 POST 数据

bash - envsubst : command not found on Mac OS X 10. 8

php - 如何检查 UPDATE mysqli 查询是否正确执行?

php - Laravel 5.0 - 在哪里使用服务提供商的绑定(bind)?

python - 如何使用 key 而不是基本身份验证用户名和密码将 Python 连接到 RESTful API?

php - 禁止获取 twitch channel 源

php - 如何在 Ubuntu 16.04 中安装 php-curl

terminal - --递归错误: Insufficient Permission: Request had insufficient authentication scopes

batch-file - 使用windows终端连接COM口