Bảng tra cứu nhanh curl
Lệnh curl gỡ lỗi API HTTP và tự động hoá: phương thức, gửi JSON, header, xác thực, upload tệp, cookie, retry và chẩn đoán TLS trên curl 8.x.
Cách hoạt động
curl transfers URL data from the shell: set method (-X), headers (-H), body (-d/-F), and output (-v/-i/-w) explicitly, because curl prints only the response body by default.
Bộ lệnh sống còn
Vài lệnh nên học trước tiên.
42 lệnh
Requests & Methods
Send GET, HEAD, POST, PUT, PATCH, and DELETE requests with clean headers.
- Cơ bản
Fetch a URL and print the response body to stdout
curl <url>Dựng lệnh
curl <url>Giá trị được chèn đúng như bạn nhập. Hãy tự đặt dấu nháy nếu giá trị có khoảng trắng hoặc ký tự đặc biệt.
Khi nào dùng
Baseline check for reachability, response payload, and pipe integration with jq.
Ví dụ
curl https://api.example.com/healthKết quả
{"status":"ok","version":"2.4.0"}
Payloads, Forms & Files
Send JSON, URL-encoded forms, multipart uploads, and binary bodies.
Auth, Cookies & TLS
Authenticate requests, manage cookies, resolve hosts, and verify certificates.
Headers, Timing & Debugging
Inspect TLS handshakes, response headers, status codes, and per-phase latency.
Downloads, Retries & Limits
Write files safely, resume interrupted downloads, cap wait time, and retry.