Search code examples
perldownloadresolve

Perl, resolving link download name


I am trying to write a script in Perl that generates URL list from web page, than goes over URL list and downloads the linked files.

the problem is that the generated URL's links look something like

www.example.com/download.php?file=Li9OaW50ZW5kby9ORVMvVVNBLzEwIFlhcmQgRmlnaHQuemlw

when i place this link in browser it knows the true file name (i.e. cards.zip), i don't know how to get it using Perl.

how can i get using Perl the link's 'true' file name ?


Solution

  • Inspect the headers, specifically Content-Disposition.