神马搜索来源记录以及User Agent

42.156.137.14 - \公众Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 YisouSpider/5.0 Safari/537.36\"大众106.11.156.57 - \"大众Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 YisouSpider/5.0 Safari/537.36\"大众42.156.137.33 - \公众Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 YisouSpider/5.0 Safari/537.36\公众42.156.137.44 - \公众Mozilla/5.0 (iPhone; CPU iPhone OS 10_3 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/56.0.2924.75 Mobile/14E5239e YisouSpider/5.0 Safari/602.1\公众106.11.153.124 - \"大众Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 YisouSpider/5.0 Safari/537.36\公众php判断搜索引擎是否为神马搜索

通过上面的三条 User Agent 信息,可以创造它们都有一个共同的 YisouSpider 字段,也便是说 User Agent 中含有 YisouSpider 字段的来访者即为神马搜索引擎的蜘蛛。

php代码

<?php//飞鸟慕鱼博客function is_yisouspider(){ $ua= addslashes(strtolower($_SERVER['HTTP_USER_AGENT'])); if (strpos($ua, 'yisouspider') !== false) {return true; } return false;}?>

函数调用:

php识别蜘蛛访问php断定神马搜刮引擎蜘蛛蜘蛛的办法 CSS

<?phpif(is_yisouspider()){ echo 'yes';}else{ echo 'no';}?>

神马搜索引擎蜘蛛IP地址

以下为神马搜索引擎蜘蛛的来访IP地址,

42.156.136.0/24:表示IP段,42.156.136.1 到 42.156.136.25442.156.136.0/2442.156.137.0/2442.156.138.0/2442.156.139.0/2442.120.160.0/2442.120.161.0/2442.156.254.0/2442.120.234.0/2442.120.235.0/2442.120.236.0/24106.11.152.0/24106.11.153.0/24106.11.154.0/24106.11.155.0/24106.11.156.0/24106.11.157.0/24106.11.158.0/24106.11.159.0/24