I need to make a POST request via cURL from the command line. Data for this request is located in a file. I know that via PUT this could be done with the --upload-file option.
curl host:port/post-file -H "Content-Type: text/xml" --data "contents_of_file"
You’re looking for the
--data-binaryargument:In the example above,
-iprints out all the headers so that you can see what’s going on, and-X POSTmakes it explicit that this is a post. Both of these can be safely omitted without changing the behaviour on the wire. The path to the file needs to be preceded by an@symbol, socurlknows to read from a file.