用php识别各种搜索蜘蛛爬行请求

196次阅读
没有评论

支持如下的搜索引擎:Baidu,Google,Bing,Yahoo,Soso,Sogou,Yodao 爬行网站的记录!

/**
 * 获取搜索引擎爬行记录
 */
function get_naps_bot()
{$useragent = strtolower($_SERVER['HTTP_USER_AGENT']);
    if (strpos($useragent, 'googlebot') !== false) {return 'Google';}
    if (strpos($useragent, 'baiduspider') !== false) {return 'Baidu';}
    if (strpos($useragent, 'msnbot') !== false) {return 'Bing';}
    if (strpos($useragent, 'slurp') !== false) {return 'Yahoo';}
    if (strpos($useragent, 'sosospider') !== false) {return 'Soso';}
    if (strpos($useragent, 'sogou spider') !== false) {return 'Sogou';}
    if (strpos($useragent, 'yodaobot') !== false) {return 'Yodao';}
    return false;
}
正文完
有偿技术支持加微信
post-qrcode
 
评论(没有评论)
验证码