Googlebot has visited

This snippet emails you when the Googlebot visits your website

<?php
if ( strpos( $_SERVER['HTTP_USER_AGENT'], 'Googlebot' ) !== false )
{
// enter your email address
$email_address = 'me@mysite.com';

// Send yourself an email
mail($email_address,'Googlebot Alert messaage', 'The Googlebot has just visited this page: '.$_SERVER['REQUEST_URI']);
}
?>