Get an email when Google visits

Simply stick this piece of code into your website or include file in php and get an email when Google visits that page! Of course, change the myemail@something.com before you put this into your website.
PHP:

    <?php
//Change the following to your email address
$email = “myemail@something.com”;
if(eregi(”googlebot”,$_SERVER[’HTTP_USER_AGENT’]))
{
mail($email, “Googlebot detected”,
“Google has crawled : “.$_SERVER[’REQUEST_URI’]);
}
?>

Perl:

 # give path of sendmail
$mailprog = ‘/usr/sbin/sendmail’;
#Change the following to your email address
$email = myemail@something.com;
$browser = $ENV{’HTTP_USER_AGENT’};
if ($browser =~ m/googlebot/i) {
open (MAIL, “|$mailprog -t”) || die “ERROR: Problem Opening - $mailprog!\n”;
print MAIL “From: $email\n”;
print MAIL “To: $email\n”;
print MAIL “Subject: Googlebot detected\n\n”;
print MAIL “Google has crawled : “.$ENV{’REQUEST_URI’};
close (MAIL);
}

So use at your own risk, and prepare to get spamed.

Leave a Comment