how to identify web crawlers of google/yahoo/msn by PHP?

前端 未结 8 1614
清酒与你
清酒与你 2020-12-29 17:51

AFAIK,

$_SERVER[\'REMOTE_HOST\'] should end up with \"google.com\" or \"yahoo.com\".

but is it the most ensuring method?

any other way out?

8条回答
  •  余生分开走
    2020-12-29 18:11

    The best way to do it with well know and behaving robots, like those you mentioned, is by user agent which you can find on $_SERVER['HTTP_USER_AGENT'].

提交回复
热议问题