bu da benim kullandığım

function botbul($userAgent) {
 $crawlers = array("Google","Googlebot","Adsbot-Google","Googlebot-Image","Googlebot-Mobile","Googlebot-News","MSNBot","MSNBot-Media","MSNBot-News","MSNPTC","Bing","Bingbot","Slurp","Baiduspider","Rambler","Yahoo","Yahoo-MMCrawler","Yandex","YandexBot","YandexImages","YandexMetrika","YandexVideo","YandexMedia","AbachoBOT","accoona","AcioRobot","ASPSeek","CocoCrawler","Dumbot","FAST-WebCrawler","GeonaBot","Gigabot","Lycos","MSRBOT","Scooter","AltaVista","IDBot","eStyle","Scrubby","MJ12bot","AhrefsBot");
foreach($crawlers as $ckey => $cisim){
    if(preg_match("/$cisim/i", $userAgent, $matches) > 0){
	$botsonuc=$cisim;
	}
}
    return $botsonuc;
}

echo botbul($_SERVER['HTTP_USER_AGENT']);