发起 GET 请求并输出响应体
curl https://api.example.com/usersHTTP 请求、认证、调试与下载续传的常用参数组合,替换域名与路径后即可直接执行。
发起 GET 请求并输出响应体
curl https://api.example.com/users静默模式但仍输出错误,适合脚本
curl -sS https://api.example.com/health同时输出响应头与响应体
curl -i https://api.example.com/users只请求响应头,快速检查可用性
curl -I https://example.com只输出状态码供脚本判断
curl -s -o /dev/null -w "%{http_code}\n" https://example.com发送 JSON 格式的 POST 请求
curl -X POST https://api.example.com/users -H "Content-Type: application/json" -d '{"name":"Tom"}'从文件读取请求体并整体更新资源
curl -X PUT https://api.example.com/users/42 -H "Content-Type: application/json" -d @payload.json只更新资源的局部字段
curl -X PATCH https://api.example.com/users/42 -d '{"active":false}'删除指定资源
curl -X DELETE https://api.example.com/users/42GET 携带自动编码的查询参数
curl -G --data-urlencode "q=Vue 3" --data-urlencode "page=2" https://api.example.com/search以 multipart 表单上传文件
curl -F "file=@./avatar.png" -F "name=Tom" https://api.example.com/upload使用 Basic 认证访问接口
curl -u admin:secret https://api.example.com/basic携带 Bearer Token 访问受保护接口
curl -H "Authorization: Bearer <TOKEN>" https://api.example.com/me用自定义请求头传递 API Key
curl -H "X-API-Key: <API_KEY>" https://api.example.com/data登录并把响应 Cookie 写入文件
curl -c cookies.txt -d "user=tom&pass=123" https://example.com/login读取 Cookie 文件维持登录态
curl -b cookies.txt https://example.com/profile打印请求与响应全过程,排查握手问题
curl -v https://api.example.com/users绕过 DNS,把域名指向本机测试
curl --resolve api.example.com:443:127.0.0.1 https://api.example.com/health通过指定代理发送请求
curl -x http://127.0.0.1:7890 https://example.com限制连接与总耗时,避免请求挂死
curl --connect-timeout 2 --max-time 5 https://example.com输出状态码与耗时统计
curl -s -o /dev/null -w "状态:%{http_code} 耗时:%{time_total}s\n" https://example.com跳过证书校验,仅用于自签名测试
curl -k https://self-signed.example.com关闭校验会失去中间人防护,生产环境禁用
跟随重定向并按远端文件名保存
curl -L -O https://example.com/files/app.tar.gz自定义保存名,避免 URL 参数干扰
curl -L -o app.tar.gz "https://example.com/download?id=42"从断点处续传未完成的下载
curl -C - -O https://example.com/files/big.iso限制下载速率,避免占满带宽
curl --limit-rate 500k -O https://example.com/files/big.iso直接执行远程脚本,来源不可信时风险极高
curl -sL https://example.com/install.sh | bash先把脚本下载下来审阅,再决定是否执行
本网站使用 Cookie 以确保您在我们的网站上获得最佳体验。 隐私政策.