Tuesday, 3 September 2013

making a curl call from linux command line


Before using curl you may have to install it

sudo apt-get install curl

curl --form "fileupload=@testfile.txt" http://demosite.com/resource.php
curl --data "param1=value1&param2=value2" http://demosite/resource.php
curl -X POST -d @testfilehttp://demosite.com/path/to/resource --header "Content-Type:text/xml" (HTTP POST containing XML)
curl -X POST -d @testfile.txthttp://demosite.com/path/to/resource --header "Content-Type:application/json" (HTTP POST JSON)

No comments:

Post a Comment