HS Banner
Back
Detect a robot/spider.

Author: Guitarman 05/16/2021
Language: PHP
Tags:


Description:

This is a simple pace of code to detect a robot/spider in your PHP website.

Article:

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


Back
Comments
Add Comment
There are no comments yet.