curl

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
原文地址:https://www.cnblogs.com/mncasey/p/8001313.html