全球主机交流论坛

标题: 求一个智能判断搜索蜘蛛的代码。 [打印本页]

作者: 小菜鸟    时间: 2011-3-30 12:16
标题: 求一个智能判断搜索蜘蛛的代码。
求代码。

7,8个域名备到一起。

北备,接入商要求网站打不开才行。
站打不开,搜索就全K了。
求一个智能判断搜索蜘蛛的代码。

用户打开网站的话,页面显示空白。
蜘蛛爬的话,网站正常。

直接用<div style="DISPLAY: none">  </div>不会影响蜘蛛收录吧。
作者: cnweb    时间: 2011-3-30 12:18
厉害
作者: 95147    时间: 2011-3-30 12:21
抄下dz有个叫is_robot的函数
作者: Poison    时间: 2011-3-30 12:27
DNS智能解析
作者: 小菜鸟    时间: 2011-3-30 12:31
求asp的代码和PHP的代码。
站点有ASP的也有PHP的。
最好是JS调用判断。
作者: cookie    时间: 2011-3-30 12:32
  1. <?php
  2. function get_bot(){
  3.     $useragent = strtolower($_SERVER['HTTP_USER_AGENT']); //关键是这个

  4.     if (strpos($useragent, 'googlebot') !== false){
  5.         return 'Googlebot';
  6.     }
  7.     if (strpos($useragent, 'msnbot') !== false){
  8.         return 'MSNbot';
  9.     }

  10.     if (strpos($useragent, 'slurp') !== false){
  11.         return 'Yahoobot';
  12.     }

  13.     if (strpos($useragent, 'baiduspider') !== false){
  14.         return 'Baiduspider';
  15.     }

  16.     if (strpos($useragent, 'sohu-search') !== false){
  17.         return 'Sohubot';
  18.     }

  19.     if (strpos($useragent, 'lycos') !== false){
  20.         return 'Lycos';
  21.     }

  22.     if (strpos($useragent, 'robozilla') !== false){
  23.         return 'Robozilla';
  24.     }
  25.     return false;
  26. }
  27. ?>
复制代码





欢迎光临 全球主机交流论坛 (https://loc.1226.eu.org/) Powered by Discuz! X3.4