Curl
curl sth.com
-H for header
-d for data "sth=sth&sth2=sth"
-O for download
-o for saving response in file (-o sth.txt)
-v for verbose output
-X is needed for specifying method -X POST
GET request
curl https://api.example.com/data
POST with form data
curl -X POST -d "key1=value1&key2=value2" https://api.example.com/submit
POST with JSON
curl -X POST -H "Content-Type: application/json" -d '{"key":"value"}' https://api.example.com/submit
curl -H "Authorization: Bearer token" https://api.example.com/protected
Download file
curl -O https://example.com/file.zip
Follow redirects
curl -L https://example.com/redirect
Basic authentication
curl -u username:password https://api.example.com/auth
Verbose output
curl -v https://api.example.com/data
Save response to file
curl -o output.txt https://api.example.com/data