You can load a local page using curl and then check it with a local validator or message using curl in the W3 Validator or your online HTML validator of your choice. Or you can write a simple web spider in some scripting languages ββand bypass the local network, checking each page as a scan. An example crawler class in Perl:
package Test::Crawler; use Moose; use WWW::Mechanize; has client => ( is => 'ro', isa => 'WWW::Mechanize', default => sub { WWW::Mechanize->new }, ); has handler => ( is => 'ro', isa => 'CodeRef', default => sub {}, ); sub crawl { my ($self, $url, $visited) = (@_, {});
And a sub sample to check with validator.nu :
sub is_valid { my ($code, $page_url) = @_; my $ua = LWP::UserAgent->new; my $url = 'http://validator.nu/?out=gnu'; my $response = $ua->post($url, Content_Type => 'text/html', Content => $code); return $response->as_string !~ /error/; }
zoul
source share