Solved

Php Googlebot detect (adsense)

Posted on 2013-01-08
2
550 Views
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 "66.249.73.45", 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
0
Comment
Question by:Pedro Chagas
2 Comments
 
LVL 4

Accepted Solution

by:
rahulgupta9x earned 350 total points
ID: 38757830
0
 
LVL 10

Assisted Solution

by:d4durvesh
d4durvesh earned 150 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.
Source:
http://stackoverflow.com/questions/677419/how-to-detect-search-engine-bots-with-php
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

708 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now