0

I'm trying to detect googlebot, or more to the point have some code not run when googlebot is viewing the page

This is what I am using

if (strpos(strtolower($_SERVER[‘HTTP_USER_AGENT’]), "google") === FALSE)

However google bot appears to be still running the code, anybody any ideas?

2
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by dragonflyuk
0

I'm pretty sure that ‘ ’ are not valid quote characters in php
so changed ‘HTTP_USER_AGENT’
to 'HTTP_USER_AGENT'

if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']), "google") === FALSE)
0

I knew that honest :$

I'd spent best part of day starring at that, and rejigging it, never spotted my mistake, even though once it's pointed out, I know it's wrong.

Once again thanks r0bb0b

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.