Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Downloading files from a Secured Site

by imp (Priest)
on May 24, 2007 at 17:32 UTC ( #617281=note: print w/ replies, xml ) Need Help??


in reply to Downloading files from a Secured Site

I like WWW::Mechanize.

Something like this:

use strict; use warnings; use WWW::Mechanize; my $mech = WWW::Mechanize->new; $mech->credentials('user', 'pass'); my $response = $mech->get('http://foo.com'); die $response->status_line unless $response->is_success; printf "content-type: %s\n", $response->header('Content-Type'); my $data = $response->content;


Comment on Re: Downloading files from a Secured Site
Download Code
Replies are listed 'Best First'.
Re^2: Downloading files from a Secured Site - response to update
by imp (Priest) on May 24, 2007 at 17:52 UTC
    In response to your update:
    You will need Crypt::SSLeay for https traffic. See the section on PKCS12 support.

    Updated example:

    use strict; use warnings; use WWW::Mechanize; use Crypt::SSLeay; $ENV{HTTPS_PKCS12_FILE} = 'certs/pkcs12.pkcs12'; $ENV{HTTPS_PKCS12_PASSWORD} = 'PKCS12_PASSWORD'; my $mech = WWW::Mechanize->new; $mech->credentials('user', 'pass'); my $response = $mech->get('https://foo.com'); die $response->status_line unless $response->is_success; printf "content-type: %s\n", $response->header('Content-Type'); my $data = $response->content;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://617281]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (12)
As of 2015-07-31 09:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (276 votes), past polls