1:curl命令发送get请求
curl http://localhost/payment
或
curl -X GET http://localhost/payment
2:curl命令发送get请求(带参数)
curl http://localhost/payment?param=value
3:curl命令发送POST请求
curl -X POST http://localhost/payment
4:curl命令发送POST请求(带参数)
curl -X POST http://localhost/payment -d "parameter=value1¶meter2=value2"
5:curl命令添加cookie
curl http://localhost/payment --cookie "user=root;pass=123456"
6:curl命令添加header
curl http://localhost/payment -H "Content-Type:application/json"
或
curl http://localhost/payment --header "X-Request-Id:3"
7:curl命令上传文件
curl http://localhost/payment -F "file=@/home/user/imgs/my.png"
注:每个命令后添加 -v 可以查看请求时更多详细信息