curl
发送 HTTP 请求并获取响应,支持多种协议和认证方式。
$ curl -X POST -H "Content-Type: application/json" https://api.example.com/upload
示例
# 上传 JSON
curl -X POST -H "Content-Type: application/json" -d '{"title":"Hello"}' https://api.example.com/posts
# 上传文件
curl -T localfile.zip https://example.com/upload
# 表单上传
curl -F "name=John" -F "avatar=@photo.jpg" https://api.example.com/upload
# PUT 更新
curl -X PUT -d '{"status":"active"}' -H "Content-Type: application/json" https://api.example.com/users/1