helo dear corion
i will try it out. and then i come back and report all.
btw. allways th0ught that i need mechanize .... duhhh aaarg there are some errors with the mechanize....
use strict;
use warnings;
use WWW::Mechanize::Firefox;
my $mech = new WWW::Mechanize::Firefox();
open my $urls, '<', 'urls.txt' or die $!;
while (<$urls>) {
chomp;
next unless /^http/i;
print "$_\n";
$mech->get($_);
my $png = $mech->content_as_png;
my $name = $_;
$name =~ s#^http://##i;
$name =~ s#/##g;
$name =~ s/\s+\z//;
$name =~ s/\A\s+//;
$name =~ s/^www\.//;
$name .= ".png";
open my $out, ">", $name or die $!;
binmode $out;
print $out $png;
close $out;
sleep 5;
}
guess it is better now....
minor things left to solve...
linux-wyee:/home/martin/perl # perl test_7.pl
http://www.unifr.ch/sfm
http://www.zug.phz.ch
http://www.schwyz.phz.ch
http://www.luzern.phz.ch
http://www.schwyz.phz.ch
+ http://www.phvs.ch
+ http://www.phtg.ch
+ http://www.phsg.ch
+ http://www.phsh.ch
+ Use of uninitia
+lized value $png in print at test_7.pl line 25, <$urls> line 10.
+
+ http://www.phr.ch
+ http://www.hepfr.ch/
http://www.phbern.ch
http://www.ph-solothurn.ch
http://www.pfh-gr.ch
Got status code 500 at test_7.pl line 14
linux-wyee:/home/martin/perl #
what do you think...
|