Curl is a command line tool for getting and sending data, using URL syntax. It is part of a project with the same name, that also includes liburl, a library with similar purpose.
Here are some examples.
Send an http request with content type "application/x-www-form-urlencoded" (option -d):
curl -d "key1=val1&key2=val2" https://davisfiore.co.uk/endpoint
Send an http request with content type "multipart/form-data" (option -F):
curl -F "key1=val1" https://davisfiore.co.uk/endpoint
Send a POST http request (option -X), with content type "multipart/form-data" (option -F), and attach a file:
curl -F "key1=val1" -F "[email protected];filename=myexample.doc" https://davisfiore.co.uk/endpoint
Send a POST http request (option -X):
curl -X POST https://davisfiore.co.uk/endpoint
Send a POST http request (option -X), setting header content type to "application/json" (option -H), and logging the request into the file dump.txt (option --trace-ascii):
curl -X POST -H "Content-Type: application/json" -d '{"key1": "val1"}' --trace-ascii "dump.txt" https://davisfiore.co.uk/endpoint
Copyright © 2013 Welcome to the website of Davis Fiore. All Rights Reserved.