增加自动识别未知爬虫的功能

This commit is contained in:
Zhai Yiming 2017-07-11 10:45:34 +08:00
parent 9a4889cf1d
commit 65836755d5

View File

@ -51,6 +51,8 @@ class Access_Parser
'crawler',
'bingbot',
'YisouSpider',
'Bot',
'Spider',
);
protected $currentBot = null;
@ -139,6 +141,10 @@ class Access_Parser
return true;
}
}
if (preg_match('#([a-zA-Z0-9]+(bot|spider))[ /]*([0-9.]*)#i', $ua, $matches)) {
$this->currentBot = $matches[1] . $matches[2];
return true;
}
} else {
return false;
}