LWP::UserAgent::Tor - rotate your ips
use LWP::UserAgent::Tor; my $ua = LWP::UserAgent::Tor->new( tor_control_port => 9051, # empty port on default range(49152 .. 65535) tor_port => 9050, # empty port on default range(49152 .. 65535) tor_config => 'path/to/torrc', # tor default config path ); if ($ua->rotate_ip) { say 'got another ip'; } else { say 'try again?'; }
Inherits directly form LWP::UserAgent. Launches tor proc in background and connects to it via socket. Every method call of rotate_ip will send a request to change the exit node and return 1 on sucess.
rotate_ip
$ua->rotate_ip;
Try to get another exit node via tor. Returns 1 for success and 0 for failure.
Inspired by a script of ac0v overcoming some limitations (no more!) of web scraping...
This is released under the Artistic License.
spebern <bernhard@specht.net>
To install LWP::UserAgent::Tor, copy and paste the appropriate command in to your terminal.
cpanm
cpanm LWP::UserAgent::Tor
CPAN shell
perl -MCPAN -e shell install LWP::UserAgent::Tor
For more information on module installation, please visit the detailed CPAN module installation guide.