I am trying to post two parameters using curl
, path
and fileName
:
curl --request POST 'http://localhost/Service' --data "path='/xyz/pqr/test/'&fileName='1.doc'"
I know something is wrong in this. I have to use something like URLEncode. I tried many things still no luck.
Please give an example how can I post the url in data of curl request.
This question is related to
linux
web-services
bash
curl
http-post
I don't think it's necessary to use semi-quotes around the variables, try:
curl -XPOST 'http://localhost/Service' -d "path=%2fxyz%2fpqr%2ftest%2f&fileName=1.doc"
%2f
is the escape code for a /
.
http://www.december.com/html/spec/esccodes.html
Also, do you need to specify a port? ( just checking :) )
Source: Stackoverflow.com