【问题标题】:cURL POST --data-binary using content from URL?cURL POST --data-binary 使用来自 URL 的内容?
【发布时间】:2015-01-16 03:23:42
【问题描述】:

是否可以使用 URL 中的内容进行 Curl -data-binary POST?

POST 文件中的内容:

curl -X POST -H "Content-Type: plain/text" --data-binary "@file.txt"  http://somewhere.com

有没有 curl 命令可以做类似的事情

curl -X POST -H "Content-Type: plain/text" --data-binary "http://somefile.com/file"  "http://somewhere.com"

假设http://somefile.com/file是一个二进制文本文件

【问题讨论】:

    标签: post curl


    【解决方案1】:

    您可以执行以下操作:

    curl -s http://somefile.com/file | curl --data-binary @- http://somewhere.com
    

    【讨论】:

    • 去掉多余的“-X POST”会更好=)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-02-16
    • 1970-01-01
    • 2013-07-14
    • 2015-02-03
    • 1970-01-01
    • 1970-01-01
    • 2011-04-05
    相关资源
    最近更新 更多