Author: Guitarman 05/16/2021
Language:
PHP
Tags:
This is a simple pace of code to detect a robot/spider in your PHP website.
if (isset($_SERVER['HTTP_USER_AGENT'])){
if (!preg_match('/bot|crawl|slurp|curl|dataprovider|search|get|spider|find|java|majesticsEO|google|yahoo|teoma|contaxe|yandex|libwww-perl|facebookexternalhit/i', $_SERVER['HTTP_USER_AGENT'])) {
//Not a bot
}
}
PHP: Something Useful - Manual