When using curl to http post a xml file to a url, how to set the parameter?

1

1

I want to use curl to http post a file to a url like:

curl -d myfile.xml http://www.example.dom/post/file/here

Can I set the parameter I want the file to be posted with? Like if it was a querystring I would do: ?file=filedatahere

How do you do that with a post?

user27449

Posted 2011-11-26T16:07:57.010

Reputation: 5 104

Answers

3

Yes you can specify parameters via querystring to a resource you are posting to. Also you should use '@' before a filename if the data is being read from a file. So using your example I believe this should look like:

curl -d @myfile.xml "http://www.example.dom/post/file/here?foo=bar&this=that"

Chad C. Davis

Posted 2011-11-26T16:07:57.010

Reputation: 31