Perl,解析链接下载名称 [英] Perl, resolving link download name
问题描述
我正在尝试在Perl中编写一个脚本,该脚本从网页生成URL列表,而不是通过URL列表并下载链接的文件。生成的URL的链接看起来像
www.example.com/download.php?file=Li9OaW50ZW5kby9ORVMvVVNBLzEwIFlhcmQgRmlnaHQuemlw
当我将此链接放在浏览器中时,它知道真正的文件名(即cards.zip),我不知道如何使用Perl。
如何使用Perl链接的'true'文件名?
检查标题,特别是 Content-Disposition
。
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 ?
Inspect the headers, specifically Content-Disposition
.
这篇关于Perl,解析链接下载名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!