curl常用命令

原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/11484512.html

GET

1 curl protocol://address:port/url?args
2 
3 curl http://127.0.0.1:8080/login?username=hello&password=world

POST

1 curl -d "args" protocol://address:port/url
2 
3 curl -d "username=hello&password=world" http://127.0.0.1:8080/login

POST with json body

1 curl -H "Content-Type: application/json" -X POST --data (json.data) protocol://address:port/url
2 
3 curl -H "Content-Type: application/json" -X POST --data '{"username": "whoami"}' http://127.0.0.1:8080/login
原文地址:https://www.cnblogs.com/agilestyle/p/11484512.html