In my site, whenever there is a visit I send a cookie and then I save datas in db (data, ip, referer, platform). The cookie is used for avoid of recording the same user visit. My question is simple: how can I identify visit from robot? Is it possible?
Asked
Active
Viewed 409 times
1 Answers
1
read User Agent
if( preg_match('/robot|spider|crawler|curl|^$/i', $_SERVER['HTTP_USER_AGENT'])) )
{
echo 'Is bot or spider or crawler or curl or not human';
}
else
{
echo 'Is human';
}
You can find a list of about 300 common user-agents given by bots here: http://www.robotstxt.org/db.html

Simone Nigro
- 4,717
- 2
- 37
- 72