How to send file contents as body entity using cURL

后端 未结 3 1360
悲哀的现实
悲哀的现实 2020-11-29 00:46

I am using cURL command line utility to send HTTP POST to a web service. I want to include a file\'s contents as the body entity of the POST. I have tried using -d &

3条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-29 01:42

    In my case, @ caused some sort of encoding problem, I still prefer my old way:

    curl -d "$(cat /path/to/file)" https://example.com
    

提交回复
热议问题