ÄAÂЪŶ¡·s¬ü¾Ç¡Iºë²Ó¤À¤u¡B±M·~³]­p
¶q¨­­q»s§¹¬ü¨t²Î®a¨ã¡A³»¯Å®É©|«~¨ý¿ï¡I
¸ËæC©î°£¥þ¨t¦C¬¡°Ê¦Ê¸­µ¡.¨¾¤õ¦w¥þªù
®ð±K¹j­µµ¡.°í©T­@¥Î.¤u¼tª½Àç.Åwªï¬¢¸ß¡C

­º­¶  ¡E  tw ½×¾Â ¡E µ{¦¡³]­p°Q½×     ¡E 

[php] php§P断来访ªÌ¬O§_¬O·j¯Á¤Þ�

©ÐªF¡G©P¤p©j
µoªí®É¶¡¡G2016-10-31
[ÀËÁ|]


function is_crawler() {
$userAgent = strtolower($_SERVER[\'HTTP_USER_AGENT\']);
$spiders = array(
\'Googlebot\', // Google ª¦¦ä
\'Baiduspider\', // ¦Ê«×ª¦¦ä
\'Yahoo! Slurp\', // ¶®ªêª¦¦ä
\'YodaoBot\', // ¦³¹Dª¦¦ä
\'msnbot\' // Bingª¦¦ä
// §ó¦hª¦¦ä关键¦r
);
foreach ($spiders as $spider) {
$spider = strtolower($spider);
if (strpos($userAgent, $spider) !== false) {
return true;
}
}
return false;
}


//该¥N码¤ù¬q来¦Û¤_: http://www.sharejs.com/codes/php/8945
¤U­±ªºphp¥N码ªþ带¤F§ó¦hªº»jµï标识
view sourceprint?
function isCrawler() {
echo $agent= strtolower($_SERVER[\'HTTP_USER_AGENT\']);
if (!empty($agent)) {
$spiderSite= array(
\"TencentTraveler\",
\"Baiduspider+\",
\"BaiduGame\",
\"Googlebot\",
\"msnbot\",
\"Sosospider+\",
\"Sogou web spider\",
\"ia_archiver\",
\"Yahoo! Slurp\",
\"YoudaoBot\",
\"Yahoo Slurp\",
\"MSNBot\",
\"Java (Often spam bot)\",
\"BaiDuSpider\",
\"Voila\",
\"Yandex bot\",
\"BSpider\",
\"twiceler\",
\"Sogou Spider\",
\"Speedy Spider\",
\"Google AdSense\",
\"Heritrix\",
\"Python-urllib\",
\"Alexa (IA Archiver)\",
\"Ask\",
\"Exabot\",
\"Custo\",
\"OutfoxBot/YodaoBot\",
\"yacy\",
\"SurveyBot\",
\"legs\",
\"lwp-trivial\",
\"Nutch\",
\"StackRambler\",
\"The web archive (IA Archiver)\",
\"Perl tool\",
\"MJ12bot\",
\"Netcraft\",
\"MSIECrawler\",
\"WGet tools\",
\"larbin\",
\"Fish search\",
);
foreach($spiderSite as $val) {
$str = strtolower($val);
if (strpos($agent, $str) !== false) {
return true;
}
}
} else {
return false;
}
}
if (isCrawler()){
echo \"§A¦n»jµïºë¡I\";
}
else{
echo \"§A¤£¬O»jµïºë°Ú¡I\";
}
//该¥N码¤ù¬q来¦Û¤_: http://www.sharejs.com/codes/php/8945




  • ÃÙ§Uºô¯¸       

    ¼s§Q¤£°Ê²£-·sªO¯S°Ï«ü¦W«×³Ì°ª¡B­È±o±z«H¿àªº¦n©Ð¥ò
    ±zªº¦«¥I,¼s§Q¥Î¤ß¬°±zªA°È
    ¼s§Q¤£°Ê²£-ªO¾ô¦b¦a¥Í®Ú³Ì¹ê¦b--·sªO¯S°Ï«ü¦W«×³Ì°ª¡B­È±o±z«H¿àªº¦n©Ð¥ò
    §¹¾ã©Ð°T¡A©Ð«Î¡B©±­±¼öªùºë¿ïª«¥ó¡A¼s§Q¤£°Ê²£ Àu½è¥ò¤¶¡A©Ð«Î¯²¸î¡B¶R½æ¸ê°T³z©ú¡A¥æ©ö¯u¦w¤ß¡I



  • ¡@¦@ 0 ¤H¦^À³

    ©m¦W¡G
    §G§i¤º®e¡G