Google bot crawl notifier


/ Published in: PHP
Save to your folder(s)

Include this in any page you want to track for Google bot crawls.
Adapt it to your needs (eg: MySQL log instead of e-mail announcement, etc).


Copy this code and paste it in your HTML
  1. <?php
  2.  
  3. $email = "[email protected]";
  4.  
  5. if(eregi("googlebot",$HTTP_USER_AGENT))
  6. {
  7. if ($QUERY_STRING != "")
  8. {
  9. $url = "http://".$SERVER_NAME.$PHP_SELF.'?'.$QUERY_STRING;
  10. } else {
  11. $url = "http://".$SERVER_NAME.$PHP_SELF;
  12. }
  13. $date = date("F j, Y, g:i a");
  14. mail($email, "[Googlebot] $url", "$date - Google crawled $url");
  15. }
  16. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.