我正在使用cURL命令行实用程序将HTTP POST发送到Web服务.我想将文件的内容包含在POST的正文实体中.我已尝试使用-d </path/to/filename>类似信息的其他变体--data </path/to/filename> --data-urlencode </path/to/filename>等...文件始终附加.我需要它作为身体实体.
我不确定这是否可行,但我正在尝试卷曲帖子,但是以json为参数,如下:
curl -X POST 'https://myserver/action?params={"field1":"something","whatever":10,"description":"body","id":"random","__oh__":{"session":"12345678jhgfdrtyui"}}'
Run Code Online (Sandbox Code Playgroud)
但是,我不断收到一些错误curl: (3) [globbing] nested braces not supported at posX.
我该怎么做呢?