Is there a way to detect if the page is visited by a bot?
I tried checking the $_SERVER['HTTP_USER_AGENT']
is within an array. It works fine.
$bot = array("Slurp", "Scooter", "URL_Spider_SQL", "Googlebot", "Firefly", "WebBug", "WebFindBot", "crawler", "appie", "msnbot", "InfoSeek", "FAST", "Spade", "NationalDirectory",);
if (in_array($_SERVER['HTTP_USER_AGENT'], $bot)) {
return true;
}
else {
return false;
}
Is there a better and secured way to do this? (other than having to type-in all the bot names?) What's the difference between my method and this?