Say we have the following perl script
use LWP; use strict; use warnings; use LWP::UserAgent; my $ua = LWP::UserAgent->new; $ua->agent('NokiaN97i/SymbianOS/9.1 Series60/3.0'); my $response = $ua->get('http://myhost.com'); if ($response->is_success) print $response->decoded_content; else die $response->status_line;
which simply connects to myhost.com/index.php and prints its contents. In the index.php file, I have
file_put_contents('agent.txt', $_SERVER['HTTP_USER_AGENT'], FILE_APPEND);
lines. The user agent string now does not contain "libwww-perl". How can I recognize a perl bot and restrict it?
source share