PHP GOOGLEBOT DETECTION SCRIPT
Views: 342
Php Googlebot detection script
"Google doesn't post a public list of IP addresses for webmasters to whitelist. This is because these IP address ranges can change, causing problems for any webmasters who have hard coded them. The best way to identify accesses by Googlebot is to use the user-agent (Googlebot)."
http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=80553
As it google say is useless to make a list of all googlebot IPs downloaded from various sources. Therefore is more eficient to use $_SERVER['HTTP_USER_AGENT'] function in php.
The php code is:
//===================
$u_agent=$_SERVER['HTTP_USER_AGENT'];
if (eregi("Googlebot", $u_agent)) {
echo "I'm the Googlebot!";
}
//==========================
|