加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

perl – 如何在提交表单后使用WWW :: Mechanize下载文件?

发布时间:2020-12-15 21:44:49 所属栏目:大数据 来源:网络整理
导读:我有代码: #!/usr/bin/perluse strict;use WWW::Mechanize;my $url = 'http://divxsubtitles.net/page_subtitleinformation.php?ID=111292';my $m = WWW::Mechanize-new(autocheck = 1);$m-get($url);$m-form_number(2);$m-click();my $response = $m-res()
我有代码:
#!/usr/bin/perl
use strict;
use WWW::Mechanize;

my $url = 'http://divxsubtitles.net/page_subtitleinformation.php?ID=111292';
my $m = WWW::Mechanize->new(autocheck => 1);
$m->get($url);
$m->form_number(2);
$m->click();
my $response = $m->res();
print $m->response->headers->as_string;

它提交了页面上的下载按钮,但我不确定如何下载POST后发回的文件.

如果可能的话,我想用wget下载这个.我以为他们可能是秘密网址传递的东西?或者我是否必须直接从响应流中下载LWP?

那么如何下载该标题中的文件?

谢谢,

科迪古德曼

解决方法

提交表单后,您可以使用:

$mech->save_content( $filename )

Dumps the contents of $mech->content into $filename. $filename will be
overwritten. Dies if there are any errors.

If the content type does not begin with “text/”,then the content is
saved in binary mode.

资料来源:http://metacpan.org/pod/WWW::Mechanize

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读