如何使用响应头文件名与cURL保存文件

问题描述:

这个问题与cURL的命令行版本有关。

This question relates to the command line version of cURL.

我试图从cgi脚本下载一个文件。

I'm trying to download a file from a cgi script.

http://someserver/perl/dl.pl?ID = 2

使用浏览器的文件名为'remotefilename.gz'
cURL想将文件保存为'dl.pl?ID=2 '

Using a browser the filename comes up as 'remotefilename.gz' cURL wants to save the file as 'dl.pl?ID=2'

如何获取cURL保存到响应头文件名的文件

How do I get cURL to save to a file with the filename from the response header??

如果您有足够新的curl(版本7.20.0或更高版本),

if you have a new enough curl (version 7.20.0 or later), -J/--remote-header-name is what you want.

您使用-J与