+ Reply to Thread + Post New Thread
Results 1 to 6 of 6

Thread: How can I detect a search engine spider using PHP

  1. #1
    Noobie
    Join Date
    Apr 2008
    Posts
    139
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How can I detect a search engine spider using PHP

    Basically I need a function that I can call that returns true or false if a spider is viewing the page. What is the best way to do this? I know I can compare user-agents, but I figured I'd check with you guys before I go out and spend time creating a solution to a problem that might already be solved here. Any code I can grab that will do this for me?

    I'm entirely new to this, so please share even the basic ideas that I am missing, Thanks!

  2. Shorten URL    SEO Services    Buy Xrumer

    Sponsored Links

  3. #2
    Noobie
    Join Date
    Apr 2008
    Posts
    137
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Do you want it in real time?

    I did think that cpanel has this as a built in feature when viewing your websites traffic?

  4. #3
    Noobie
    Join Date
    Apr 2008
    Posts
    88
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    user agent is the only way

  5. #4
    Noobie
    Join Date
    Apr 2008
    Posts
    117
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    What are you using this for?

    If it's for giving extremely different content to bots and users you're going to want to get a good list of bot IPs and identify them that way. Otherwise, you risk getting found out and blacklisted.

    If it is simply for internal metrics, or some other small on-page modifications, then go for user agent. (But don't expect it to catch all the bots.)

  6. #5
    Noobie
    Join Date
    Aug 2008
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    use Cpanel, or if you want to put it on ur site, maybe ..

    just gugling for PHP script for SpiderBot visit

  7. #6
    SEO Apprentice Reverse's Avatar
    Join Date
    Aug 2010
    Posts
    26
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    The most common way on detecting bots/spiders is obviously via user agent. (PHP: $_SERVER['HTTP_USER_AGENT'])
    But you can also usually detect via reverse dns. (PHP: gethostbyaddr). The hostname will usually contains strings should as "google", "bot", "spider", "yahoo", etc.
    Hope this helps.

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts