Solved

Php Googlebot detect (adsense)

Posted on 2013-01-08
2
568 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

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

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

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
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.
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…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

690 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