码迷,mamicode.com
首页 > Web开发 > 详细

curl

时间:2017-12-08 00:00:57      阅读:291      评论:0      收藏:0      [点我收藏+]

标签:filename   mobile   curl   size   传递数据   auth   mob   access   通过   

CURL可以传递请求数据

 

默认curl使用GET方式请求数据,这时可通过URL传递数据;

可通过 --data/-d 方式指定使用POST方式传递数据

# GET
curl -u username https://api.github.com/user?access_token=XXXXXXXXXX

# POST
curl -u username --data "param1=value1&param2=value" https://api.github.com

当为json格式的post请求时,格式如下:
url -l -H "Content-type: application/json" -X POST -d ‘{"mobile":"13345699999","password":"123654"}‘https://www.abc.com/
# 也可以指定一个文件,将该文件中的内容当作数据传递给服务器端 curl --data @filename https://github.api.com/authorizations

 

curl

标签:filename   mobile   curl   size   传递数据   auth   mob   access   通过   

原文地址:http://www.cnblogs.com/mncasey/p/8001313.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!