#!/usr/local/bin/perl use LWP::UserAgent; use LWP::ConnCache; my $browser = LWP::UserAgent->new(conn_cache => 1); $browser->conn_cache(LWP::ConnCache->new()); my @lines = qw(9.9.9.9 8.8.8.8 7.7.7.7 6.6.6.6 5.5.5.5); my $start = time; my $url = 'https://xxx.xxx.com/'; my $count = 0; foreach (@lines) { my $response = $browser->get( $url, 'X-Forwarded-For' => $_, ); print $response->as_string; $count += length $_; sleep(1); } print time() - $start; print " secs\n$count\n";
In reply to Re^2: LWP::UserAgent single session
by adismaug
in thread LWP::UserAgent single session
by adismaug
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |