更新时间:2022-04-05 05:39:24
GET:
使用 JSON:
curl -i -H "Accept: application/json" -H "Content-Type: application/json" http://hostname/resource
使用 XML:
curl -H "Accept: application/xml" -H "Content-Type: application/xml" -X GET http://hostname/resource
发布:
发布数据:
curl --data "param1=value1¶m2=value2" http://hostname/resource
文件上传:
curl --form "fileupload=@filename.txt" http://hostname/resource
RESTful HTTP Post:
curl -X POST -d @filename http://hostname/resource
用于登录站点(身份验证):
curl -d "username=admin&password=admin&submit=Login" --dump-header headers http://localhost/Login
curl -L -b headers http://localhost/