RE: LWP getstore

2004-12-03 Thread Brian Volk
Dave,

Ugh thank you!  That worked prefect.  :~)

Brian 

> -Original Message-
> From: Dave Gray [mailto:[EMAIL PROTECTED]
> Sent: Friday, December 03, 2004 11:19 AM
> To: Beginners (E-mail)
> Subject: Re: LWP getstore
> 
> 
> > I'm having trouble w/ getstore... It works fine when I use 
> it like this
> [snip]
> > ... but when I use in the script below, all that happens is 
> the files are
> > created but they are only 1kb and can not be displayed...  
> When I use the
> > script above the file size is 14kb and looks great...  
> Obviously, I'm not
> > "get"ing the data.. :~)  If possible, can someone point me 
> in the right
> > direction.   BTW this script works great when I use it 
> as a screen
> > scraper w/ HTML::TokeParser...
> [snip]
> >my $images = getstore($url,$file);
> >  die "Error $images on $url" unless is_success($images);
> > 
> >open(OUT, ">", $file) or die "can't open $file:$!";
> >print OUT $images;
> >close (OUT);
> [snip]
> 
> The three lines dealing with OUT are clobbering all your files after
> they get downloaded. Try commenting those out.
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
> 
> 
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: LWP getstore

2004-12-03 Thread Dave Gray
> I'm having trouble w/ getstore... It works fine when I use it like this
[snip]
> ... but when I use in the script below, all that happens is the files are
> created but they are only 1kb and can not be displayed...  When I use the
> script above the file size is 14kb and looks great...  Obviously, I'm not
> "get"ing the data.. :~)  If possible, can someone point me in the right
> direction.   BTW this script works great when I use it as a screen
> scraper w/ HTML::TokeParser...
[snip]
>my $images = getstore($url,$file);
>  die "Error $images on $url" unless is_success($images);
> 
>open(OUT, ">", $file) or die "can't open $file:$!";
>print OUT $images;
>close (OUT);
[snip]

The three lines dealing with OUT are clobbering all your files after
they get downloaded. Try commenting those out.

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




FW: LWP getstore

2004-12-03 Thread Brian Volk
Hi All, 
 
I sent this email yesterday, but I never saw it post... I'm sure as soon as
I send it again, it will appear.. :~)
 
Thanks!
 
Brian 

-Original Message-
From: Brian Volk 
Sent: Thursday, December 02, 2004 1:26 PM
To: Beginners (E-mail)
Subject: LWP getstore 


Hi All,
 
I'm having trouble w/ getstore... It works fine when I use it like this
 
use strict;
use warnings;
use LWP::Simple;
 
my $url = 'http://www.kcprofessional.com/us/images/products/41026.jpg';
my $file = 'E:/Perl/41026.jpg';
 
getstore( $url, $file );
 
END
 
... but when I use in the script below, all that happens is the files are
created but they are only 1kb and can not be displayed...  When I use the
script above the file size is 14kb and looks great...  Obviously, I'm not
"get"ing the data.. :~)  If possible, can someone point me in the right
direction.   BTW this script works great when I use it as a screen
scraper w/ HTML::TokeParser... 
 
These are the two files I'm using:
 
kc_urls_images3.txt =
http://www.kcprofessional.com/us/images/products/34607.jpg
<http://www.kcprofessional.com/us/images/products/34607.jpg> 
http://www.kcprofessional.com/us/images/products/34865.jpg
<http://www.kcprofessional.com/us/images/products/34865.jpg> 
http://www.kcprofessional.com/us/images/products/17713.jpg
<http://www.kcprofessional.com/us/images/products/17713.jpg> 
 
item_jpg.txt =
12345
12346
12347
 
___BEGIN___
 
use strict;
use warnings;
use LWP::Simple;

my $urlfile = 'E:/Perl/Files/kc_urls_images3.txt' ;
my $itemfile = 'E:/Perl/Files/item_jpg.txt' ;
 
open(URL, "<", $urlfile) or die "couldn't read urls: $!";
open(ITEM, "<", $itemfile) or die "couldn't read items: $!";
 
my @urls =  ;
my @items= ;
 
close(URL);
close(ITEM);
 
while (@urls) {
   my $url = shift(@urls);
   chomp $url;
   my $file = shift(@items);
   chomp $file;
 
   my $images = getstore($url,$file);
 die "Error $images on $url" unless is_success($images);
 
   open(OUT, ">", $file) or die "can't open $file:$!";
   print OUT $images;
   close (OUT);
}
 
___END
 
 
Thanks!
 
Brian Volk
HP Products
317.298.9950 x1245
 <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED]
 
 



LWP getstore

2004-12-03 Thread Brian Volk
Hi All,
 
I'm having trouble w/ getstore... It works fine when I use it like this
 
use strict;
use warnings;
use LWP::Simple;
 
my $url = 'http://www.kcprofessional.com/us/images/products/41026.jpg';
my $file = 'E:/Perl/41026.jpg';
 
getstore( $url, $file );
 
END
 
... but when I use in the script below, all that happens is the files are
created but they are only 1kb and can not be displayed...  When I use the
script above the file size is 14kb and looks great...  Obviously, I'm not
"get"ing the data.. :~)  If possible, can someone point me in the right
direction.   BTW this script works great when I use it as a screen
scraper w/ HTML::TokeParser... 
 
These are the two files I'm using:
 
kc_urls_images3.txt =
http://www.kcprofessional.com/us/images/products/34607.jpg
 
http://www.kcprofessional.com/us/images/products/34865.jpg
 
http://www.kcprofessional.com/us/images/products/17713.jpg
 
 
item_jpg.txt =
12345
12346
12347
 
___BEGIN___
 
use strict;
use warnings;
use LWP::Simple;

my $urlfile = 'E:/Perl/Files/kc_urls_images3.txt' ;
my $itemfile = 'E:/Perl/Files/item_jpg.txt' ;
 
open(URL, "<", $urlfile) or die "couldn't read urls: $!";
open(ITEM, "<", $itemfile) or die "couldn't read items: $!";
 
my @urls =  ;
my @items= ;
 
close(URL);
close(ITEM);
 
while (@urls) {
   my $url = shift(@urls);
   chomp $url;
   my $file = shift(@items);
   chomp $file;
 
   my $images = getstore($url,$file);
 die "Error $images on $url" unless is_success($images);
 
   open(OUT, ">", $file) or die "can't open $file:$!";
   print OUT $images;
   close (OUT);
}
 
___END
 
 
Thanks!
 
Brian Volk
HP Products
317.298.9950 x1245
  [EMAIL PROTECTED]