Detecting Crawlers?

apoorav

New Member
Messages
110
Reaction score
2
Points
0
Can any body give me PHP code to detect web crawlers(BOTS) crawling the webpage

For Example, it should show that GOOGLE bot was last visitor and similarly should show total list.
 

Mr. DOS

Member
Messages
230
Reaction score
5
Points
18
I don't have code to give you, but you'll want to check the PHP internal variable $_SERVER['HTTP_USER_AGENT'] against a list of user agents used by bots (Google for them). If a match is found, you can then log it.

--- Mr. DOS
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
I don't have code to give you, but you'll want to check the PHP internal variable $_SERVER['HTTP_USER_AGENT'] against a list of user agents used by bots (Google for them). If a match is found, you can then log it.

This will get you a list of the "legit" bots. The "not-so-legit" bots spoof IE or Firefox. They also ignore robots.txt.
 
Top