¨t²Î®a¨ãÃoÂd³]p±M®a¡A°ª«~½è§âÃö ¾ãÅé©~®a¨t²Î³ÃÑݨã¬ü¾Ç»P¹ê¥Î¡AÅwªï¿ïÁÊ | ![]() | ¨®®w¡B¤u¼t¡B²y³õµ¥¦U¦¡¦a©W¤uµ{±ÀÂ˧K¶O¦ô»ù ±ÄEPOXY¡A@¿i@»ÄÆP¡AÅwªï¨Ó¹q¬¢¸ß |
[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 |
|