首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > PHP >

记要蜘蛛爬行历史-PHP版

2013-09-10 
记录蜘蛛爬行历史--PHP版? function get_naps_bot(){$useragent strtolower($_SERVER[HTTP_USER_AGENT

记录蜘蛛爬行历史--PHP版

<? 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;}function nowtime(){$date=date("Y-m-d.G:i:s");return $date;}$searchbot = get_naps_bot();if ($searchbot) {$tlc_thispage = addslashes($_SERVER['HTTP_USER_AGENT']);$url=$_SERVER['HTTP_REFERER'];$file="robotlog.txt";$time=nowtime();$data=fopen($file,"a");fwrite($data,"Time:$time robot:$searchbot URL:$tlc_thispage\n");fclose($data);}?>

热点排行