tony1234567893 has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w use strict; use WWW::Mechanize; use HTTP::Cookies; #use LWP::Debug qw(+); my $url = "https://home.host.net/"; my $username = "myuser"; my $password = "mypassword"; my $mech = WWW::Mechanize->new(); # # Get URL and login # $mech->cookie_jar(HTTP::Cookies->new()); $mech->get($url); $mech->form_name('Form1'); $mech->field("txtUsername", $username); $mech->field("txtPassword", $password); $mech->click(); my $url2 = "https://home.myhost.net/test/Reports/Users/FileToDownload. +zip"; my $tempfile = "C:/MyLocalFile.zip"; my $contents = $mech->get($url2, ':content_file' => $tempfile ); print "link found\n" if defined $contents;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: download a file from a web page
by Khen1950fx (Canon) on Aug 02, 2010 at 21:22 UTC | |
by tony1234567893 (Initiate) on Aug 06, 2010 at 19:07 UTC |