Error getting URL

150 views
Skip to first unread message

samira

unread,
Feb 23, 2009, 6:53:47 AM2/23/09
to WWW::Mechanize users
I`m using wwwMechanize to download a list of urls in the file to my
hard,
when this script read an url that does not exist,program with this
error can`t continue anymore:
Error getting url
Here is my code:
use strict;
use WWW::Mechanize;
use File::Basename;
use HTML::Parser;
use Crypt::SSLeay;
#use LWP::Debug qw(+);

open F,"urls.txt" or die "I can not open it:$!";
my $mech = WWW::Mechanize->new( autocheck => 1 );
my @array = <F>;
foreach my $link(@array){
$link =~ s/\s+$//g;
my $url = $link;
$link =~ s/\///g;
my $filename = $link;
$mech->get( $url);
$mech->success or die "Can't get the $url";
$mech->save_content( $filename );
}

foobar

unread,
Feb 23, 2009, 10:27:52 AM2/23/09
to www-mecha...@googlegroups.com
if what you want is to be able to continue, set the autocheck param to 0 (btw that's the default)

2009/2/23 samira <samira....@gmail.com>

Andy Lester

unread,
Feb 23, 2009, 10:35:28 AM2/23/09
to www-mecha...@googlegroups.com

On Feb 23, 2009, at 9:27 AM, foobar wrote:

> if what you want is to be able to continue, set the autocheck param
> to 0 (btw that's the default)


Not any more. It changed in 1.49_01.

xoxo,
Andy

--
Andy Lester => an...@petdance.com => www.petdance.com => AIM:petdance

samira khansha

unread,
Feb 24, 2009, 2:30:17 AM2/24/09
to www-mecha...@googlegroups.com
thanks,it`s ok,I set autocheck param to 0 and chenged this line:
$mech->success or next;#die "Can't get the $url";
it continues.
Reply all
Reply to author
Forward
0 new messages