PHP Code

Receive a alert when the Googlebot visits

Here's a neat little PHP code snippet I picked up in the webmaster forums, that alerts you whenever the googlebot visits your site/page. Basically, it detects the user agent, and emails you the info upon detection of the googlebot.

I warn you though that if you have a lot of pages/sites, and you update regularly, you could be receiving a lot of emails. You might want to create a rule to filter the emails into a specific folder. Here's the code:

$email = "";
if( eregi("googlebot", $_SERVER&#91;'HTTP_USER_AGENT'&#93;) )
   mail($email, "Googlebot Alert",
           "Google just indexed the following page: " .


  1. I prefer not puting on your common page header/footer. Your e-mail will be flood.

Leave a Reply


Anti-spam image