<?xml version="1.0" encoding="windows-1252"?>
<node id="359375" title="zentara's scratchpad" created="2004-06-02 08:16:38" updated="2005-08-13 23:07:21">
<type id="182711">
scratchpad</type>
<author id="131741">
zentara</author>
<data>
<field name="doctext">
&lt;code&gt;
#!/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, "&gt;$filename" ) or die $!;

my $user = 'zentara';
my $pass = 'foobar';

my $expected_length;
my $bytes_received = 0;

my $ua = new LWP::UserAgent;
$ua-&gt;protocols_allowed( [ 'https'] );

 #setup request
 my $req = GET($url); 
 $req-&gt;authorization_basic($user, $pass);

#do it         
 my $response = $ua-&gt;request($req);

 if ($response-&gt;is_error())
        	{
        	        printf " %s\n", $response-&gt;status_line;
        	        print "https request error!\n";
        	} else {
        	        my $content = $response-&gt;content();
        	        print IN $content;
		        }

  print $response-&gt;status_line;

close IN;
exit;

 
&lt;/code&gt;</field>
</data>
</node>
