curl的用法
Posted mengff
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了curl的用法相关的知识,希望对你有一定的参考价值。
GET请求
curl http://localhost:8888/mock/api
POST请求(-X可以省略,-d默认就是POST参数)
curl -X POST -d ‘{"name":"api1","content":"api1 conent","method":"get","url":"/users"}‘ -H ‘Content-Type: application/json‘ http://localhost:8888/mock/api
PUT请求
curl -X PUT -d ‘{"name":"api1","content":"api1 conent","method":"get","url":"/users"}‘ -H ‘Content-Type: application/json‘ http://localhost:8888/mock/api
DELETE请求
curl -X DELETE -d ‘{"name":"api1","content":"api1 conent","method":"get","url":"/users"}‘ -H ‘Content-Type: application/json‘ http://localhost:8888/mock/api
以上是关于curl的用法的主要内容,如果未能解决你的问题,请参考以下文章
CentOS yum 命令出现 [Errno 14] curl#6 - "Couldn't resolve host ..." 的解决方法(代码片段