Forum Moderators: coopster
if(eregi("googlebot",$HTTP_USER_AGENT))
{
if ($QUERY_STRING!= "")
{$url = "http://".$SERVER_NAME.$PHP_SELF.'?'.$QUERY_STRING;}
else
{$url = "http://".$SERVER_NAME.$PHP_SELF;}
$today = date("F j, Y, g:i a");
mail("you@youremail.com", "Googlebot detected on [$SERVER_NAME",...] "$today - Google crawled $url");
}
you can use php for shure for this. the commands needed are called fopen(), fwrite() and fclose(). you can even create a log while appending (the 'a' or 'a+' option in fopen) to that file. checkout the phpdocs, they come even with examples about this. the chapter is called 'file system functions'.
Put an empty file called googlebot.txt in the directory and make sure it's writable ('CHMOD 666' should do the trick).
The @s before the functions surpress error messages, so you don't serve Googlebot PHP errors in case anything goes wrong.