Visitors Today: 207
Total Visits: 429999

Do you have source code, articles, and tutorials to share?
Visual Basic, VB.NET, C#, PHP/MySQL, C/C++, Java/JavaScript, ASP/ASP.NET, MS Access, FoxPro, SQL
You can write your own content here.


    If the information on this site helps you and you would like to make donation to please click the LINK below.

    If you want to support us, please make a contribution. Any amount is appreciated. To make a donation via PayPal, credit card, or e-check..

    Please click the DONATE link..

    Your contribution will make grow in the future.



A Simple PHP Bot Checker (Are you human?)

    Posted GraniteGear Posted On November 6, 2014

    PHP 0 Current Comments 1211 Views

    Like 1 people liked this.
    UPDATE:  You can get an up to date list of bots for use in the function below from here:  Visit

    Ever needed to quickly check if the user is a bot in php?  Here’s a simple all-in-one function that allows you to do just that.

    Just use it like this:
    if (!is_bot()) {
       echo "human";

    or this:
    if (is_bot()) {
       echo "bot";

    Here’s the function:
    function is_bot() {
       $spiders = array(
           "big brother",
           "die blinde kuh",
           "download express",
           "emacs-w3 search engine",
           "evliya celebi",
           "felix ide",
           "fish search",
           "hku www octopus",
           "html index",
           "inspector web",
           "internet shinchakubin",
           "link validator",
           "microsoft url control",
           "ncsa beta",
           "netcarta webmap engine",
           "open text",
           "orb search",
           "pack rat",
           "pgp key agent",
           "popular iconoclast",
           "raven search",
           "road runner",
           "site searcher",
           "site valet",
           "tach black widow",
           "url check",
           "web core",
           "web hopper",
           "web wombat",
           "weblog monitor",
           "wild ferret",

       foreach($spiders as $spider) {
           //If the spider text is found in the current user agent, then return true
           if ( stripos($_SERVER['HTTP_USER_AGENT'], $spider) !== false ) return true;
       //If it gets this far then no bot was found!
       return false;


  • PHP
Share With Your Friends
Share Your Thoughts With Other Users

Be the first to comment.

Leave a Reply
This small test serves as access restriction against malicious bots.