Not an expert but is the problem that you are using single quotes instead
of double. When you use single quotes variables aren't interpreted.
-- 
D. M. Monarres ([EMAIL PROTECTED])

Some people have parts that are so private they themselves have no
knowledge of them.


On Sat, 11 Aug 2001 16:03:15 Lara J. Fabans wrote:
> I have www.cobbler-sw.com/images/birds1.jpg
> I want to be able to pull birds1.jpg out from that.  I thought
> LWP would be the easiest for copying birds1.jpg to my
> local directory.
> 
> So, the error that I get is:
> ./copyUp.pl www.cobbler-sw.com/images/birds1.jpg
> www.cobbler-sw.com/images/birds1.jpg: Can't connect to $fullurl:80 (Bad 
> hostname '$fullurl')
> 
> And the code is:
> use strict;
> use LWP::UserAgent;
> use URI;
> $| = 1;  # autoflush
> my $url = shift;
> ## Failed using just www.cobbler-sw.com/images/birds1.jpg
> ## Can't connect to $url:80 (Bad hostname '$url')
> my $fullurl = "http://"; . $url;
> my $agent = LWP::UserAgent->new;
> my $request = HTTP::Request->new('GET', 'http://$fullurl');
> $url =~ /\w+\/(\w+\.*)$/;
> my $file = $1;
> my $directory = "/home/lara/image/";
> unless (-d $directory)
> {
> `mkdir $directory`;
> }
> opendir(D, $directory);
> 
> my $response = $agent->request($request, '$file');
> $response->is_success or die "$url: ", $response->message,"\n";
> closedir(D);
> 
> 
> Any help would be greatly appreciated.  I've got my nose buried in Dr. 
> Stein's Network
> Programming with Perl, but there just comes a time when you need a boot
> to 
> the head.
> 
> Thanks,
> Lara
> ---------------------
> Lara J. Fabans
> Lodestone Software, Inc
> [EMAIL PROTECTED] 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to