Function to check if visitor is a bot
This function will check whether the visitor is a search engine robot
function is_bot(){ $botlist = 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($botlist as $bot){ if(strpos($_SERVER['HTTP_USER_AGENT'],$bot)!==false) return true; // Is a bot } return false; // Not a bot }
There’s any other better way?
Related Posts- Post Slug in PHP
- Cache Class for PHP
- Print folder contents recursive with indent - PHP
- Add PDF files inside other PDF in PHP
- Error in Open Classifieds 1.4.2 function isSpam() missing
- Time to check your Google PageRank again!
- 5 Reasons Google Wave Is Not Ready
- Bicycle Maintenance
- Professional Blogging Roundup: All Saints Day Edition
Help sharing and Flatter me ;)

Thanks for sharing this. Really a big help!
Thank you for the idea! I didn’t know this was so easy!
You are welcome :)
I will try this code out. thanks for sharing anyway.
Hi its me again.. i tried your code it didn’t catch the bots. After creating a script with your function to check if a visitor is a robot, I setup a table to record visitors IP adresses and will not record if the visitor is a robot. But I got lots of visits from google(I’m familiar with Google bots IP adresses). My site is still being crawled at the moment…
Hello lim, the bot is in the array bot list?
because if you didn’t would not work.
regards
ps: works fine to me ;)