wget有一个很好的选项,允许您从同一个位置下载多个文件。
(我指的是--base和--input-file的结合)
这样做的好处是,如果可能的话,wget尝试重用打开的套接字/连接。
我想知道是否可以使用wget执行多个POST请求。(我可能最终会用python编写它,因为我无法在wget的文档中找到这样的用途)
也就是说,在输入文件中,我会有post数据(在我的例子中是json):
{"results":1}
{"results":2}并请求如下:
wget --header "Content-Type: application/json" -i input.data http://example.com/api/data发布于 2015-05-03 16:37:32
我想你是在找--post-file参数。-i用于GET方法(提供URL列表),而不是POST:
wget --header "Content-Type: application/json" --post-file input.data http://example.com/api/data另一种选择是使用curl:
curl -H "Content-Type: application/json" -X POST -d @input.data http://example.com/api/data您可以参考手册页。
https://serverfault.com/questions/688255
复制相似问题