使用PHP实现蜘蛛访问日志统计
• 经验
使用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);}