Verify web proxy servers at www.publicproxyservers.com
merlyn
created: 2006-03-22 00:09:29
In response to [id://538394], I decided to try a proxy tester combined with a [cpan://XML::LibXML] screen scraper. Works pretty well, if you have a few minutes to run the test. Please change "www.example.com" to an appropriate probe URL.
#!/usr/bin/perl
use strict;

use XML::LibXML;
use LWP::UserAgent;

my $URL = "http://www.example.com/";

my $ua = LWP::UserAgent->new;
$ua->timeout(5);

my $parser = XML::LibXML->new;
$parser->recover(1);

for my $count (1..9) {

  my $doc = do {
    local *STDERR;
    open STDERR, ">/dev/null";
    $parser->parse_html_file("http://www.publicproxyservers.com/page$count.html");
  };

  for my $row ($doc->findnodes("//b[. = \"IP\"]/../../../tr")) {
    my ($host, $port) = ($row->findvalue("td[1]"), $row->findvalue("td[2]"));
    next unless $host =~ /^\d/;
    print "$host:$port... ";
    $ua->proxy("http", "http://$host:$port/");
    my $res = $ua->get("http://www.example.com");
    print $res->status_line, "\n";
  }

}

perlmonks.org content © perlmonks.org and merlyn

prlmnks.org © 2006 edmund von der burg (eccles & toad)

v 0.03