使用命令行cURL发布文件内容

nei*_*sav 4 curl

我试图用来cURL将数据发布到URL。URL要求<form>提交,并且<textarea>字段具有指定的值。我将值存储在一个文本文件中,我想运行cURL将文件中数据的内容发布到网页上。这就是我所拥有的-但是我认为我没有正确地转义文件位置:

curl -data info='@filename.txt' https://file.com/test > tmp.txt
Run Code Online (Sandbox Code Playgroud)

Jon*_*oni 5

查看手册页,将文件内容作为POST变量发送的正确语法是:

curl --data-urlencode 'info@filename.txt' https://file.com/test > tmp.txt
Run Code Online (Sandbox Code Playgroud)