Always Be Notified When Google Crawls Your Site - By PHP Expert


Have you ever wanted to know when Google crawls your website? Well now you can using a simple PHP script which emails you everytime GoogleBot crawls your site.

I thought that many of you might find this bit of code useful, that is why I have decided to post it up.

It is not a very long piece of code, but I will talk you through how it functions.

First off lets take a look at the code:

  1. <?php 
  2. if ( strpos$_SERVER[\'HTTP_USER_AGENT\'], \'Googlebot\' ) !== false ) 
  3. // Your email address 
  4. $email_address = \'you@yourdomain.com\'
  5.  
  6. // Send yourself an email 
  7. mail($email_address,\'Googlebot Alert\'\'The Googlebot has visited your page: \'.$_SERVER[\'REQUEST_URI\']); 
  8. ?> 

As you can see it is a simple piece of code.

First of all it checks the user agent to see if it is ‘Googlebot’. If the user agent is ‘Googlebot’ then it will send an email to the email address you supply.

No comments

Enter your email address:

Delivered by FeedBurner

OR

 Subscribe in a reader

 
jQuery UI provides a comprehen
 
Program Plan   I drafted a p
 
I present to you my skills, ac
 
Introduction One of the issue
 
If you are a PHP developer and
 
cURL is a great tool to help y
 
cformsII cforms is a powerful
 
  The lack of Unicode su
 
History PHP-GTK was origina
 
Performance on the web is stra
 
Listen t
 
What\'s the number one cost in
 
When you\'re discussing the In
 
Classe
 
A service-oriented architectur
 
Introduc
 
PHP Crons and Linux Linux has
 
Cross site scripting (XSS) is
 
What Makes a Web 2.0 Applicati
 
As you develop web application
 
Cryptogr
 
Posting
 
Have you
 
Resources The Google API - ht
 
Get Started
 
Output B
 
If you r
 
PHP has some really sweet new
 
There were some new php.ini di
 
In PHP 5 there are some new fu
 
The following code implements
 
The following code snippet imp
 
A fine implementation of the o
 
Exception handling PHP 5 adds
 
Support for dereferencing obje
 
Static members Classes defini
 
Explicit object cloning In or
 
final methods The final keywo
 
Interfaces Gives the ability
 
The new object oriented featur
 
Sometimes its the little thing
 
Consider your file is at locat
 
# If a method can be static, d