ultranerds has asked for the wisdom of the Perl Monks concerning the following question:
..and I get this error:my $url_to_get = $_[1] || $details->{client_detail_url_list_offers +}; my $ua = LWP::UserAgent->new; $ua->agent("Import Script for VoyageForum"); $ua->timeout(10); #$ua->env_proxy; # if we have an @ in the URL, they will be giving us something lik +e ftp://someone:somewhere@doamin.com .. so we need to process this ap +propriatly.. my $request; if ($url_to_get =~ /\@/) { my @split = split /\@/, $url_to_get; # [ftp://user:pass] @ [do +main.com] # ok, lets try and get the bit after //, so we have the user/p +ass combo... if ($split[0] =~ m|(.*)//(.*)|) { print $IN->header; #print qq|Got user/pass combo of: $2 \n|; my ($user,$pass) = split /\:/, $2; $request = HTTP::Request->new(GET => qq|$1/$split[1]|); $request->authorization_basic($user, $pass); print qq|Bla, got URL of: "$1//$split[1]" <br />user: $use +r <br />pass: $pass <br /><br />|; #exit; } } else { $request = HTTP::Request->new(GET => $url_to_get); } my $response = $ua->request($request);
Bla, got URL of: "http://domain.org/illicotravel_import/marmara.txt" user: dev pass: password
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: LWP::Useragent - why doesn't this code work? :/
by BrowserUk (Patriarch) on Jun 14, 2010 at 14:43 UTC | |
by ultranerds (Hermit) on Jun 14, 2010 at 14:52 UTC | |
by almut (Canon) on Jun 14, 2010 at 15:08 UTC | |
|
Re: LWP::Useragent - why doesn't this code work? :/
by almut (Canon) on Jun 14, 2010 at 14:43 UTC | |
by ultranerds (Hermit) on Jun 14, 2010 at 14:47 UTC | |
|
Re: LWP::Useragent - why doesn't this code work? :/
by ikegami (Patriarch) on Jun 14, 2010 at 16:08 UTC |