How to recognize bots with php?

后端 未结 7 883
囚心锁ツ
囚心锁ツ 2020-12-24 14:33

I am building stats for my users and dont wish the visits from bots to be counted.

Now I have a basic php with mysql increasing 1 each time the page is called.

7条回答
  •  無奈伤痛
    2020-12-24 15:08

    Have you tried identifying them by their user-agent information? A simple google search should give you the user-agents used by Google etc.

    This, of course, is not foolproof, but most crawlers by major companies supply a distinct user-agent.

    EDIT: Assuming you do not want to restrict the bots access, but just not count its visit in your statistc.

提交回复
热议问题