次のPerlスクリプトがあるとしましょう
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;
myhost.com/index.php ページに接続してそのコンテンツを出力するだけです。私が持っているindex.phpファイルに
file_put_contents('agent.txt', $_SERVER['HTTP_USER_AGENT'], FILE_APPEND);
ライン。現在、ユーザー エージェント文字列には「libwww-perl」が含まれていません。どうすれば perl ボットを認識して制限できますか?