Skip to content

Instantly share code, notes, and snippets.

Created Jul 12, 2012
What would you like to do?
An IP address is used at random.
# サーバに割り当てた任意の IP アドレスを利用する
# (本コードではランダムに選択)
use LWP::UserAgent (@LWP::Protocol::http::EXTRA_SOCK_OPTS);
# ランダムに IP を選択
my @IP = qw(
push(@LWP::Protocol::http::EXTRA_SOCK_OPTS, LocalAddr => $IP[rand(@IP)]);
my $ua = LWP::UserAgent->new(agent => 'Bot/0.1', keep_alive => 1);
my $html = $ua->get('')->content;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment