开发者

Downloading or requesting a page using a proxy list?

开发者 https://www.devze.com 2023-03-21 15:52 出处:网络
I was wondering if that was possible to request an internet page from its server via a proxy taken from a proxy list.

I was wondering if that was possible to request an internet page from its server via a proxy taken from a proxy list.

I don't really know all the exact terms, so I'll just explain what I want: say there is a feature in a website which counts IPs or something alike (perhaps cookies), such as visitors counter. I'd like to "fool" it by "entering" the page using many proxies. I could use something like Tor, but that's too much work - I only want开发者_JAVA百科 to visit a page, let the counter or whatever in the page know that I visited, and that's all.

I don't really know which tags to add, but I had some little experiments with Perl so I think that could be a good direction, although I couldn't find a solution for my problem.

Thank you in advance.


You want something like this:

#/usr/bin/perl
use strict; use warnings;
use LWP::UserAgent;

my $url = shift || 'http://www.google.com';

my $a = LWP::UserAgent->new;
$a->agent('Mozilla/5.0');
$a->timeout(20);
while (<DATA>) {
  $a->proxy( ['http'], $_ );
  warn "Failed to get page with proxy $_\n"
    unless $a->get( $url )->is_success;
}

__DATA__
http://85.214.142.3:8080
http://109.230.245.167:80
http://211.222.204.1:80

The code doesn't require much explanations. LWP::UserAgent allows specifying a proxy server.

Loop through a list of proxies, get the wanted page and you're done.

0

精彩评论

暂无评论...
验证码 换一张
取 消