I don't have code to give you, but you'll want to check the PHP internal variable $_SERVER['HTTP_USER_AGENT'] against a list of user agents used by bots (Google for them). If a match is found, you can then log it.
I don't have code to give you, but you'll want to check the PHP internal variable $_SERVER['HTTP_USER_AGENT'] against a list of user agents used by bots (Google for them). If a match is found, you can then log it.