curl常用命令及参数

来源:互联网 发布:平面转立体软件 编辑:程序博客网 时间:2024/05/16 06:23

常用参数

-X/--request [GET|POST|PUT|DELETE|]  使用http method发出request-H/--header                          设定request中的header-i/--include                         现实response的header-d/--data                            设定 http的parameters -v/--verbose                         输出比较多的信息-u/--user                            使用者账号密码-b/--cookie                           cookie  

GET/POST/PUT/DELETE

curl -X GET "http://www.rest.com/api/users"curl -X POST "http://www.rest.com/api/users"curl -X PUT "http://www.rest.com/api/users"curl -X DELETE "http://www.rest.com/api/users"

post json 数据

curl --header "Content-type: application/json" --request POST --data "{\"name\":\"goog\",\"price\":900.00}" http://localhost:9000/items

Windows下要用转义\”

http://ju.outofmemory.cn/entry/84875

0 0