curl 模拟 http发送get/post请求

参考https://blog.csdn.net/u012340794/article/details/71440604

使用curl 发送GET请求

curl http://localhost:8081/login?admin&asp;password=123456

使用curl 发送POST请求

curl -d "admin&asp;password=123456" http://localhost:8081/login

使用curl 发送JSON字符串的POST请求

这种方法是参数直接在header里面的,如需将输出指定到文件可以通过重定向进行操作.
curl -H "Content-Type:application/json" -X POST -d 'json data' URL

例如: curl -H "Content-Type:application/json" -X POST -d '{"username": "0","password": "10"}' http://localhost:8081/login

猜你喜欢

转载自www.cnblogs.com/slovey/p/9265962.html