Php Googlebot detect (adsense)

Posted on 2013-01-08
Medium Priority
Last Modified: 2013-01-09
Hi E's, Every time I open a page in my site I send information to my database. The problem is I have Google Ad-sense in my page, and sometimes when I open a page Google check Ad-sense, and that opening page (Google check) will write also to my database, and is that situation I want avoid, I just want information from human customer, not from google.
For example today the IP address of Googlebot is "", and sometimes they change that IP.

What I need is something like this:
if(NOT Googlebot){
mysql_query("insert into table.........

Open in new window

Note: I don't want block googlebot at all, I just don't want them in my database.

How I detect googlebot?

The best regards, JC
Question by:Pedro Chagas

Accepted Solution

Rahul Gupta earned 1400 total points
ID: 38757830
LVL 10

Assisted Solution

d4durvesh earned 600 total points
ID: 38758913
Hi you can do following,

if(!NOT strstr(strtolower($_SERVER['HTTP_USER_AGENT']), "googlebot"))
    mysql_query("insert into table.........

Open in new window

Thank You!
Naik Durvesh.

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
This holiday season, we’re giving away the gift of knowledge—tech knowledge, that is. Keep reading to see what hacks, tips, and trends we have wrapped and waiting for you under the tree.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question