curl发送带中文的get请求
curl -G "http://localhost:8080/search" --data-urlencode school=华
等价于curl http://localhost:8080/search?school=华
curl发送json格式的post请求
curl -H "Content-Type:application/json" -H "Data_Type:msg" -X POST --data '{
"user_name": "yinxiaochen",
"user_phone": "183****0250"
}' http://127.0.0.1:8080/add
本文介绍了如何使用curl命令行工具发送带有中文参数的GET请求和JSON格式的POST请求。对于GET请求,示例展示了如何通过`-G`和`--data-urlencode`选项传递参数。对于POST请求,演示了如何设置`Content-Type`头并传递JSON数据。这两个例子对于理解curl在API调用中的应用非常有帮助。

1万+

被折叠的 条评论
为什么被折叠?



