所以我有这个卷曲请求(在Windows cmd提示符下运行):
curl --insecure -g -X POST -H "Content-Type: application/json" -d {\"from\":\"someName\",\"message\":\"this is a message\"} https://some/website/here
Run Code Online (Sandbox Code Playgroud)
当我运行这个时,我收到一个错误:
curl: (6) Could not resolve host: is; Host not found
curl: (6) Could not resolve host: a; Host not found
curl: (6) Could not resolve host: message; Host not found
Run Code Online (Sandbox Code Playgroud)
这似乎是因为json被吹了 - 空间不起作用!
如果我希望空格出现在呃消息中,我将如何发送此消息?
使用双引号"并在url中使用%20
刚试过我的Windows命令提示符.你在DATA部分遗漏了逃脱
你的代码
curl --insecure -g -X POST -H "Content-Type: application/json" -d {\"from\":\"someName\",\"message\":\"this is a message\"} https://some/website/here
Run Code Online (Sandbox Code Playgroud)
应该像这样逃脱
curl --insecure -g -X POST -H "Content-Type: application/json" -d "{\"from\":\"someName\",\"message\":\"this is a message\"}" https://some/website/here
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4110 次 |
| 最近记录: |