curl get和post请求丨技术开发分享录

curl get和post请求

{{ detail.nickname }}

转载 翻译 {{ formatTime(detail.create_time) }} 字数 {{ detail.content && detail.content.length }} 阅读 {{ detail.read_num }} {{ formatTag(v) }}

"## get请求\n\n```\n$ curl https://xxx.com/api/token?username=xxx&password=xxx&expiration=60\n```\n\n跳过https签名证书验证\n\n```\n$ curl -k https://xxx.com/api/token?username=xxx&password=xxx&expiration=60\n```\n\n## post请求\n\n```shell\n$ curl -X POST -d '{\"username\":\"xxx\", \"password\":\"xxx\", \"expiration\":60}' \"https://xxx.com/api/token\"\n```\n\n跳过https签名证书验证\n\n```shell\n$ curl -X POST -d '{\"username\":\"xxx\", \"password\":\"xxx\", \"expiration\":60}' \"https://xxx.com/api/token\" -k\n```\n\n添加请求头\n\n```shell\n$ curl -H \"Content-Type: application/json\" -X POST -d '{\"username\":\"xxx\", \"password\":\"xxx\", \"expiration\":60}' \"https://xxx.com/api/token\"\n```"
PS:写作不易,如要转裁,请标明转载出处。

如果此篇对您有帮助,可小额赞助,以兹鼓励!

猜你想看