Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

Call Function

$
0
0

Hello, how can i add a function call within this php script to echo the result as either "the bot is" or "no bots found" im not sure on how to code it and make use of this script?

Thanks

 

<?php
protected function isBot()
{
/* This function will check whether the visitor is a search engine robot */
 
    $bots = array("Teoma", "alexa", "froogle", "Gigabot", "inktomi",
    "looksmart", "URL_Spider_SQL", "Firefly", "NationalDirectory",
    "Ask Jeeves", "TECNOSEEK", "InfoSeek", "WebFindBot", "girafabot",
    "crawler", "www.galaxy.com", "Googlebot", "Scooter", "Slurp",
    "msnbot", "appie", "FAST", "WebBug", "Spade", "ZyBorg", "rabaz",
    "Baiduspider", "Feedfetcher-Google", "TechnoratiSnoop", "Rankivabot",
    "Mediapartners-Google", "Sogou web spider", "WebAlta Crawler","TweetmemeBot",
    "Butterfly","Twitturls","Me.dium","Twiceler");
 
    foreach($bots as $bot)
    {
            if(strpos($_SERVER['HTTP_USER_AGENT'], $bot) !== false)
                return true;
    }
 
    return false;
}
?>

Viewing all articles
Browse latest Browse all 13200