[PHP] 접속한 UuserAgent 가 로봇인지 체크하는 함수 - checkRobot > PHP

본문 바로가기

PHP

[PHP] [PHP] 접속한 UuserAgent 가 로봇인지 체크하는 함수 - checkRobot

회원사진
하나를하더라도최선을
2022-06-27 01:13 1,457 0

본문



접속한 UuserAgent 가 로봇인지 체크하는 함수 예제

function checkRobot($ua){

   if(empty($ua)){ $ua = $_SERVER['HTTP_USER_AGENT'];   }

   $list = array(

      "Yeti",

      "YandexBot",

      "Googlebot",

      "Cowbot",

      "NaverBot",

      "Daum",

      "Daumoa",

      "TechnoratiSnoop",

      "Allblog\.net",

      "CazoodleBot",

      "nhn\/1noon",

      "Feedfetcher\-Google",

      "Yahoo\! Slurp",

      "msnbot",

      "bingbot",

      "MSNBot",

      "Technoratibot",

      "sproose",

      "CazoodleBot",

      "ONNET\-OPENAPI",

      "UCLA CS Dept",

      "Snapbot",

      "DAUM RSS Robot",

      "RMOM",

      "S20 Wing",

      "FeedBurner",

      "xMind",

      "openmaru feed aggregator",

      "ColFeed",

      "MJ12bot",

      "Twiceler",

      "ia_archiver",

      "BingPreview", // 2022-02-06 추가 

      "NetcraftSurveyAgent", // 2022-02-06 추가 

      "Bot", // 2022-03-28 추가 

      "bot", // 2022-03-28 추가 

   );



   $check = "/(".implode("|",$list).")/";

   if(preg_match($check, $_SERVER['HTTP_USER_AGENT'])){

      return true;;

   }else{

      return false;

   }



}



$botchk = checkRobot(); // true or false

출처 :: https://blog.redinfo.co.kr/post/view?pid=52

댓글목록0

등록된 댓글이 없습니다.
게시판 전체검색