This question relates to the command line version of cURL.
I\'m trying to download a file from a CGI script.
http://example.com/perl/dl.pl?ID=2
if you have a new enough curl (version 7.20.0 or later), -J/--remote-header-name is what you want.
You use -J in conjunction with -O, which makes curl use the file name part from the URL as its primary way to name the output file and then if there is a Content-disposition: header in the response, curl will use that name instead.