Records of crawling websites such as Baidu, Google, Bing, Yahoo, Soso, Sogou, and Yodao
The Code is as follows:
01 <? Php02 // http://www.tongqiong.com03 function get_naps_bot ()04 {05 $ useragent = strtolower ($ _ SERVER ['HTTP _ USER_AGENT ']);0607if (strpos ($ useragent, 'googlebot ')! = False ){08 return 'Google ';09}1011if (strpos ($ useragent, 'baidider ider ')! = False ){12 return 'baidu ';13}14if (strpos ($ useragent, 'msnbot ')! = False ){15 return 'bin ';16}1718if (strpos ($ useragent, 'slurp ')! = False ){19 return 'yahoo ';20}2122if (strpos ($ useragent, 'sosospider ')! = False ){23 return 'sososo ';24}2526if (strpos ($ useragent, 'sogou spider ')! = False ){27 return 'sogou ';28}2930if (strpos ($ useragent, 'yodaobot ')! = False ){31 return 'yodao ';32}33 return false;34}3536 function nowtime (){37 $ date = date ("Y-m-d.G: I: s ");38 return $ date;39}4041 $ searchbot = get_naps_bot ();4243if ($ searchbot ){44 $ tlc_thispage = addslashes ($ _ SERVER ['HTTP _ USER_AGENT ']);45 $ url = $ _ SERVER ['HTTP _ referer'];46 $ file = "www.tongqiong.com.txt ";47 $ time = nowtime ();48 $ data = fopen ($ file, "");49 fwrite ($ data, "Time: $ time robot: $ searchbot URL: $ tlc_thispage \ n ");50 fclose ($ data );51}52 // http://www.tongqiong.com53?>