使用管道获取卷曲数据 [英] use pipe for curl data

查看:71
本文介绍了使用管道获取卷曲数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将cat输出传递给curl:

I'm trying to pass the cat output to curl:

$ cat file | curl --data '{"title":"mytitle","input":"-"}' http://api

但是input实际上是-.

推荐答案

我花了一段时间试图弄清楚这一点,并使其与以下各项一起工作:

I spent a while trying to figure this out and got it working with the following:

cat data.json | curl -H "Content-Type: application/json" -X POST -d @- http://api

这篇关于使用管道获取卷曲数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆