Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

zentara's scratchpad

by zentara (Cardinal)
on Jun 02, 2004 at 12:16 UTC ( [id://359375]=scratchpad: print w/replies, xml ) Need Help??

#!/usr/bin/perl use warnings; use strict; use HTTP::Request::Common qw(GET); use LWP::UserAgent; my $url ='https://zentara.zentara.net/~zentara/zentara1.avi'; my $filename = substr( $url, rindex( $url, "/" ) + 1 ); #print "$filename\n"; open( IN, ">$filename" ) or die $!; my $user = 'zentara'; my $pass = 'foobar'; my $expected_length; my $bytes_received = 0; my $ua = new LWP::UserAgent; $ua->protocols_allowed( [ 'https'] ); #setup request my $req = GET($url); $req->authorization_basic($user, $pass); #do it my $response = $ua->request($req); if ($response->is_error()) { printf " %s\n", $response->status_line; print "https request error!\n"; } else { my $content = $response->content(); print IN $content; } print $response->status_line; close IN; exit;
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2024-10-10 20:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The PerlMonks site front end has:





    Results (45 votes). Check out past polls.

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.