D
D
David Manzhula2015-07-18 20:57:31
PHP
David Manzhula, 2015-07-18 20:57:31

How to identify a bot by User-agent?

How to identify a bot by User-agent?
Pen is interested in any bots - search engines, from social networks, in short - not real people.
How to determine them by User-Agent?
Let's say they don't change the User-agent to "normal".
if anything - I need to sort the logs

Answer the question

In order to leave comments, you need to log in

5 answer(s)
S
Sergey, 2015-07-18
@da411d

How to determine that the search bot and not a person?

D
David Manzhula, 2015-07-18
@da411d

So far I have this code:

if(strlen($useragent)<75){
  $isbot = 'BOT';
}else if(strlen($useragent)>100){
  $isbot = 'USER';
}else{
  $isbot = 'ХЗ, '.strlen($useragent);
}

M
myfirepukan, 2015-07-18
@myfirepukan

You can reliably determine only by IP or you need to connect JavaScript and watch the behavior

P
Puma Thailand, 2015-07-19
@opium

well, in their user agent it is written what kind of bot they are, take it and sort it

A
Alexander Leleka, 2021-05-11
@Laweb

Implementation with a small function in php
https://youtu.be/Dz-eDdHs4m8

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question