,,使用PHP实现蜘蛛访问日志统计
本篇文章是对使用PHP?服务器端编程语言(Professional Hypertext Preprocessor的缩写)实现蜘蛛访问日志统计的代码进行了详细的分析介绍,需要的朋友参考下
复制代码代码如下:$ user agent=adds lasses(strtolpower($ server[' http _ user _ agent '));
if (strpos($useragent,“googlebot”)!=false){ $ bot='谷歌;} else if(strpos(user agent,“media partners-Google ”)!=false){ $ bot=' Google adsense ';}elseif (strpos($useragent,' baiduspider ')!=false){ $ bot='百度';} else if(strpos(user agent,"搜狗蜘蛛")!-不,不,不,不,不,不,不,不,不,不,不,不,不,不,不,不,不,不,不,不,不,不,不,不,不,不,不,不,不,不,不!}elseif (strpos($useragent,'搜狗网')!=false){ $ bot='搜狗web ';}elseif (strpos($useragent,' sosisters ')!(假){ $ bot='搜搜';}elseif (strpos($useragent,' 360spider ')!-=ytet-伊甸园字幕组=-翻译:}elseif (strpos($useragent,' yahoo ')!==false){ $ bot=' Yahoo ';}elseif (strpos($useragent,' msn ')!==false){ $ bot=' MSN ';}elseif (strpos($useragent,' msnbot ')!(假){ $ bot=' msnbot}elseif (strpos($useragent,'搜狐')!(假){ $ bot='搜狐;}elseif (strpos($useragent," yodaobot ")!=false){ $ bot=' yo Dao ';}elseif (strpos($useragent,' twiceler ')!-=ytet-伊甸园字幕组=-翻译:}elseif (strpos($useragent,' ia_archiver ')!(假){ $ bot=' Alexa _}elseif (strpos($useragent,' iaarchiver ')!(假){ $ bot=' Alexa}elseif (strpos($useragent," slurp))!=false){$bot='雅虎";}elseif (strpos($useragent,' bot ')!=false){$bot='其它蜘蛛";} if(isset($ bot)){ $ FP=@ fopen(' bot。txt ',' a ');fwrite($fp,date('Y-m-d H:i:s ').\t .$ server[' remote _ addr ']。\t .$bot美元“t”。http://号服务器['服务器名称'].$ server[' request _ uri '].\ r \ n ';fclose美元(FP);}
郑重声明:本文由网友发布,不代表盛行IT的观点,版权归原作者所有,仅为传播更多信息之目的,如有侵权请联系,我们将第一时间修改或删除,多谢。