curl 参数速查
curl 高频参数速查,接口调试、文件下载、认证场景全覆盖,复制即用。
广告位(百度联盟)
| 命令 | 说明 | 示例 | |
|---|---|---|---|
| curl -I | 仅查看响应头 | curl -I https://it586.cn | |
| curl -i | 查看响应头 + 响应体 | curl -i https://api.ipify.org | |
| curl -sS | 静默输出但显示错误 | curl -sS https://api.ipify.org; echo | |
| curl -X POST | 指定请求方法 | curl -X POST https://api.x.com/v1/login | |
| curl -H | 自定义请求头(带 Token) | curl -H "Authorization: Bearer TOKEN" https://api.x.com/me | |
| curl -d | 发送表单数据 | curl -d "username=admin&pwd=1" https://api.x.com/login | |
| curl --data-raw | 发送原始 JSON 体 | curl -H "Content-Type: application/json" --data-raw '{"a":1,"b":2}' https://api.x.com/v1 | |
| curl -G | GET 附带查询参数 | curl -G https://api.x.com/s --data-urlencode "q=hello" | |
| curl -F | 上传文件(multipart) | curl -F "file=@/tmp/a.png" https://api.x.com/upload | |
| curl -u | HTTP 基础认证 | curl -u user:pass https://api.x.com/sec | |
| curl -c / -b | 保存并携带 Cookie | curl -c jar.txt -d "..." https://x.com/login; curl -b jar.txt https://x.com/home | |
| curl -L | 跟随重定向 | curl -sL https://short.url/abc | |
| curl -o | 保存响应到文件 | curl -o page.html https://it586.cn | |
| curl -C - | 断点续传 | curl -C - -o big.iso https://mirror/big.iso | |
| curl -k | 忽略 SSL 证书校验 | curl -k https://self-signed.local | |
| curl -v | 输出详细通信过程 | curl -v https://it586.cn | |
| curl -x | 通过代理访问 | curl -x http://127.0.0.1:7890 https://ifconfig.me | |
| curl --max-time | 设置最大超时(秒) | curl --max-time 10 https://api.x.com | |
| curl -A | 自定义 User-Agent | curl -A "Mozilla/5.0" https://x.com | |
| curl -w | 输出自定义指标 | curl -s -o /dev/null -w "http=%{http_code}" https://it586.cn | |
| curl --retry | 失败自动重试 | curl --retry 3 --retry-delay 2 https://api.x.com | |
| curl -T | PUT 上传文件 | curl -T file.txt ftp://host/ |