You can use either IP addresses or the "User-agent" line sent by the bot or web browser.
Googlebot ( ) , $_SERVER ['HTTP_USER_AGENT'], , . :
Googlebot/2.1 (+ http://www.google.com/bot.html)
NutchCVS/0.8-dev (Nutch; http://lucene.apache.org/nutch/bot.html
Baiduspider + (+ http://www.baidu.com/search/spider_jp.html)
Mozilla/5.0 (X11; U; Linux i686; ru-US) AppleWebKit/531.4 (KHTML, , Gecko)
:
PHP , . - :
$searchengines = array(
'Googlebot',
'Slurp',
'search.msn.com',
'nutch',
'simpy',
'bot',
'ASPSeek',
'crawler',
'msnbot',
'Libwww-perl',
'FAST',
'Baidu',
);
$is_se = false;
foreach ($searchengines as $searchengine){
if (!empty($_SERVER['HTTP_USER_AGENT']) and
false !== strpos(strtolower($_SERVER['HTTP_USER_AGENT']), strtolower($searchengine)))
{
$is_se = true;
break;
}
}
if ($is_se) { print('Its a search engine!'); }
, (Google Analytics ) 100% . - , - . , 95% + /.