💾 Archived View for gem.sdf.org › s.kaplan › cheatsheets › commandline-tools › curl.md captured on 2024-05-12 at 15:31:35.
⬅️ Previous capture (2023-09-08)
-=-=-=-=-=-=-
# cURL Cheatsheet ## Overview of unique features - Command-line tool for transferring data - Supports a wide range of protocols (HTTP, FTP, SMTP, etc.) - Can be used for testing APIs and web services - Can be used for web scraping and data extraction ## Basic usage
curl http://example.com
curl -X POST -d "param1=value1¶m2=value2" http://example.com
curl -H "Authorization: Bearer token" http://example.com
curl -o output.txt http://example.com
## Authentication
curl -u username:password http://example.com
curl -H "Authorization: Bearer token" http://example.com
## Cookies
curl -b "cookie1=value1; cookie2=value2" http://example.com
curl -c cookies.txt http://example.com
curl -b cookies.txt http://example.com
## Advanced usage
curl -L http://example.com
curl -A "Mozilla/5.0" http://example.com
curl --connect-timeout 10 http://example.com
curl -x http://proxy.example.com:8080 http://example.com
## Resources - [cURL documentation](https://curl.se/docs/) - [cURL tutorial](https://curl.se/docs/httpscripting.html) - [cURL forum](https://stackoverflow.com/questions/tagged/curl) for community support and troubleshooting.