Solved

Php Googlebot detect (adsense)

Posted on 2013-01-08
2
562 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 4

Accepted Solution

by:
Rahul Gupta 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 …
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

756 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