See if some version of the attached program
gives the results you expect.


Mike


On 2/13/2018 8:33 PM, beginners-digest-h...@perl.org wrote:
I tried WWW::Mechanize, and (of course) got also 403.

Really strange.

Is there another tool I could use for checking? I mean some tool in the
Perl universe?

-- Manfred





#
#
# This scipt checks links in the html in the __DATA__ section 
# and reports if they are good links or bad links.
#
#
#!/usr/bin/perl -w

use strict;

use LWP::UserAgent;
use HTML::LinkExtor;

#--
#-- i am being very lazy in the demo
#-- you should really localize it in a block
#--
local $/;

my $p = HTML::LinkExtor->new(\&hrefs)->parse(<DATA>);

sub hrefs{

        my($tag,@links) = @_;

        return unless($tag =~ /^a$/i);

        my $p = LWP::UserAgent->new->request(
                 HTTP::Request->new(GET => $links[1]));

        print $p->is_success ? "GOOD: $links[1]" :
              $p->status_line . " $links[1]", "\n";
}

__DATA__

<html>
<a href="http://scripts.sil.org/robots.txt";>
<a href="https://shlomif.github.io/";>
<a href="https://notabug.org";>
<a href="http://scripts.sil.org/OFL";>
</html>





__END__


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/

Reply via email to