Records of Baidu,google,bing,yahoo,soso,sogou,yodao crawling sites can be recorded
The code is as follows:
01 //http://www.tongqiong.com03function Get_naps_bot ()24905$useragent = Strtolower ($_server[' http_user_agent ');0607if (Strpos ($useragent, ' Googlebot ')!== false) {08return ' Google ';09}1011if (Strpos ($useragent, ' Baiduspider ')!== false) {12return ' Baidu ';13}14if (Strpos ($useragent, ' MSNBot ')!== false) {15return ' Bing ';16}1718if (Strpos ($useragent, ' slurp ')!== false) {19return ' Yahoo ';20}21st22if (Strpos ($useragent, ' Sosospider ')!== false) {23return ' Soso ';24}2526if (Strpos ($useragent, ' Sogou spider ')!== false) {27return ' Sogou ';28}2930if (Strpos ($useragent, ' Yodaobot ')!== false) {31return ' Yodao ';32}33return false;34}3536function Nowtime () {37$date=date ("y-m-d.g:i:s");38return $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, "a");49fwrite ($data, "Time: $time Robot: $searchbot URL: $TLC _thispage\n");50fclose ($data);51}52//http://www.tongqiong.com53?>
http://www.bkjia.com/PHPjc/735091.html www.bkjia.com true http://www.bkjia.com/PHPjc/735091.html techarticle record codes for Baidu,google,bing,yahoo,soso,sogou,yodao crawling sites can be recorded as follows: 01?php 02//http://www.tongqiong.com 03functionget_ Naps_bot () 04{05$useragent=strtolower ($ ...