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?

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)

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.