curl is a command line tool that lets you make http requests.

-- Simple GET request
curl foo.com


-- HEAD request
curl -I foo.com
curl --head foo.com


-- GET request with response headers included
curl -i foo.com


-- One or more GET requests that follow redirects
curl -L foo.com


-- Save GET request to file
curl foo.com -o /tmp/index.html
curl foo.com --output /tmp/index.html


-- Save GET request to same named file as remote
curl foo.com/happy.png -O
curl foo.com/happy.png --remote-name


-- Explicit GET request with request headers
curl -X GET foo.com \
     -H "Authorization: Bearer Ymggb4J69s8" \
     -H "Content-Type: application/json"


-- POST request with json body
curl -X POST "https://api.foo.com/client/v4/1234" \
     -H "X-Auth-Email: user@example.com" \
     -H "X-Auth-Key: 0bbcd638f5e225cf483cc5cfdda41" \
     -H "Content-Type: application/json" \
     --data '{"value":"off"}'


-- -X option allows other methods such as GET, POST, PUT, PATCH, DELETE
-- and some WebDAV methods like PROPFIND, COPY, MOVE and more.

Resources