Skip to content

Instantly share code, notes, and snippets.

@m00s
Created October 9, 2015 16:22
Show Gist options
  • Save m00s/1857b4a09cf4e18a412e to your computer and use it in GitHub Desktop.
Save m00s/1857b4a09cf4e18a412e to your computer and use it in GitHub Desktop.
How to perform HTTP requests using curl

Make GET requests with extra headers:

curl --request GET 'http://www.somedomain.com/user/info/' \ --header 'sessionid:1234567890987654321'

Make GET and have the response with HTTP headers:

curl --request GET 'http://somedomain.com/' --include

Make POST with headers and body:

curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"userid": "user", "password":"psw"}' http://host/api-route

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment