Short for Client URL and is a command-line tool used for transferring data to or from a server using various protocols.
HTTP Requests
| Purpose | Command |
|---|---|
| Basic GET request | curl websitename.com |
| Download file | curl websitename.com/file.html |
| HTTPS certificate validation | curl -k https://websitename.com |
| Print full HTTP request/response | curl websitename.com -v |
| Send HEAD request (only headers) | curl -I https://websitename.com |
| Print response headers and body | curl -i https://websitename.com |
| Set User-Agent header | curl websitename.com -A 'Mozilla/5.0' |
| HTTP basic auth (in URL) | curl http://username:password@websitename.com/ |
| HTTP basic auth (separate credentials) | curl -u username:password http://websitename.com/ |
| Set custom request header | curl -H 'Authorization: Bearer token123' websitename.com |
| Send GET request with parameters | curl 'websitename.com/search?query=example' |
| Send POST request with form data | curl -X POST -d 'username=admin&password=pass' |
websitename.com/login | |
| Send POST request with JSON data | curl -X POST -d '{"username":"admin"}' -H |
'Content-Type: application/json' websitename.com/api | |
| Set request cookies | curl -b 'session=abc123' websitename.com |