On May 4, 9:46 am, tony1234567...@yahoo.co.uk (Tony Esposito) wrote:
> Cheers!
>
> New to LWP and downloading file/copying file from Web to local box.  Had a go 
> at it and failed horribly...  On Solaris 10 with Perl 5.10.
> #!/usr/bin/perl -w
> use strict;
> use LWP::Simple qw($ua get);
> my $webpage ="https://www.mywebpage.com/Documents.zip";;
> $ua->timeout(20);
> my $content = get $webpage or die "Page timed out...$!\n";
> if (defined $content) {
>   open FILE,"> Documents.zip" or die "Can't create file";
>   binmode FILE;
>   print FILE $content;
>   close FILE;} else {
>
>   print "LWP get() failed\n";}
>
> exit;
>
> Don't see where I authenticate -- login and password, that is.  Get system 
> timed out as an error.  Any help would be grateful.

Can you fetch the document manually with your browser...? What
does the login challenge look like then? Since there was a timeout,
did you make multiple attempts or try increasing the timeout value?

I see you've already enabled LWP::UserAgent by importing '$ua'
but it  may be easier just to use LWP::UserAgent. If you're new
to LWP, you'll probably want to look at:  perldoc lwptut. That doc
will explain how to use the credentials method if the site uses basic
authentication.

--
Charles DeRykus


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to