您的位置:首页 > 运维架构 > 网站架构

判断访问你网站的搜索引擎还是真实用户

2011-04-19 13:44 309 查看
function is_bot()
{
/* This function will check whether the visitor is a search engine robot */
//根据需要扩充此数组
$botlist = array("Teoma", "alexa", "froogle", "Gigabot", "inktomi",
"looksmart", "URL_Spider_SQL", "Firefly", "NationalDirectory",
"Ask Jeeves", "TECNOSEEK", "InfoSeek", "WebFindBot", "girafabot",
"crawler", "www.galaxy.com", "Googlebot", "Scooter", "Slurp",
"msnbot", "appie", "FAST", "WebBug", "Spade", "ZyBorg", "rabaz",
"Baiduspider", "Feedfetcher-Google", "TechnoratiSnoop", "Rankivabot",
"Mediapartners-Google", "Sogou web spider", "WebAlta Crawler","TweetmemeBot",
"Butterfly","Twitturls","Me.dium","Twiceler");

foreach($botlist as $bot)
{
if(strpos($_SERVER['HTTP_USER_AGENT'],$bot)!==false)
return true;	// Is a bot
}

return false;	// Not a bot
}


/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息