Linux curl命令进行网络请求

原创:转载需注明原创地址 https://www.cnblogs.com/fanerwei222/p/11841353.html

 

1. curl get请求:

curl http://www.baidu.com

2. curl post请求: -H表示请求头, -X表示代理, --data表示请求体的JSON数据

curl -H "Content-Type:application/json" -H "other : hello" -X POST --data "{\"hello\":\"world\",\"yes\":\"no\"}" http://127.0.0.1:8080/test/api/hello

 

posted @ 2019-11-12 13:47  前往幸福的路上  阅读(1215)  评论(0编辑  收藏  举报