Page 1 of 1

spoting spiders/crawlers

Posted: Sat Apr 30, 2005 10:20 am
by scriptmaster
hi

is there any way I can detect a webcrawler/spider hit like "googlebot" on my index.php page?
is there a certain property or sign that only a spider has that PHP can detect to conclude and be sure a certain page request is a spider?

thanks
sorry if my english sucks

Posted: Sat Apr 30, 2005 5:44 pm
by SystemWisdom
Well, all spiders/bots have a user-agent signature (as far as I know), and I think googles contains something like: Mediapartners-Google, so maybe something like this will work for you?

Code: Select all

if( stripos( $_SERVER['HTTP_USER_AGENT'], 'Mediapartners-Google' ) !== false )
	{
		// Do stuff..
	}