Results 1 to 7 of 7

 

Thread: Useful bot script (PHP)

  1. #1
    Affiliate Marketeer

    Status
    Offline
    Join Date
    Aug 2003
    Location
    Manchester
    Posts
    855
    Thanks
    26
    Thanked 15 Times in 13 Posts


    Want to know when the bots last crawled your site?

    Add this to your PHP page(s).

    PHP Code:
    <?php 
    // send an e-mail if google crawls this page 
    if(eregi("googlebot",$HTTP_USER_AGENT)){ 
    // to test this script, change "googlebot" to "mozilla" 
    if ($QUERY_STRING!= ""){ 
    $url "http://".$SERVER_NAME.$PHP_SELF.'?'.$QUERY_STRING
    }else{ 
    $url "http://".$SERVER_NAME.$PHP_SELF

    $today date("F j, Y, g:i a"); 
    mail("email@domain.com""Googlebot detected on http://$SERVER_NAME""$today - Google crawled $url"); 

    ?>

    Just change to 'mail' variable to your own and then just sit and wait!
    You can test it by using 'mozilla' instead of 'googlebot'. Remember to change it back tho, or you'll get a shedload of emails

  2. #2
    Frostie's Avatar
    Moderator

    Status
    Offline
    Join Date
    Aug 2003
    Location
    Wirral
    Posts
    3,217
    Thanks
    61
    Thanked 60 Times in 27 Posts
    Only just found this - great little script monkeyman, have added it and already received an email about googlebot arriving

    Any other little snippets would be welcome. thanks a million

  3. #3
    Affiliate Marketeer

    Status
    Offline
    Join Date
    Aug 2003
    Location
    Manchester
    Posts
    855
    Thanks
    26
    Thanked 15 Times in 13 Posts
    No probs - glad to help.

    I actually put it onto one of my template pages which pulls over 1000 products out and Google hit onto every one of em, resulting in over a 1000 emails!

  4. #4
    Frostie's Avatar
    Moderator

    Status
    Offline
    Join Date
    Aug 2003
    Location
    Wirral
    Posts
    3,217
    Thanks
    61
    Thanked 60 Times in 27 Posts
    The script above, I guess, will work with other bots but obviously change the "googlebot" bit to something else.

    if(eregi("ANY.OLD.OTHER.BOT",$HTTP_USER_AGENT)){

    So what other bots could I type in, where it says "googlebot"?

    I have found a list of loads of bots here, but which are the main ones to watch out for? Any help would be appreciated.

    Mushy Grassy Ass
    Last edited by Frostie; 22-10-03 at 03:46 PM.

  5. #5
    Affiliate Marketeer

    Status
    Offline
    Join Date
    Aug 2003
    Location
    Manchester
    Posts
    855
    Thanks
    26
    Thanked 15 Times in 13 Posts
    Shedloads here mate - http://www.jafsoft.com/searchengines...ots_and_others

    I've mainly seen these ones in my logs :-

    ia_archiver
    Scooter
    FAST-WebCrawler
    GalaxyBot
    Slurp
    HenryTheMiragoRobot
    teoma_agent1

    Hope that helps!

  6. #6
    Frostie's Avatar
    Moderator

    Status
    Offline
    Join Date
    Aug 2003
    Location
    Wirral
    Posts
    3,217
    Thanks
    61
    Thanked 60 Times in 27 Posts
    So if I added the following code, I would get an email if Google, Yahoo, Alexa or Mirago came calling?

    <?php
    // SET DETAILS
    $url = "http://".$SERVER_NAME.$PHP_SELF;
    $today = date("F j, Y, g:i a");

    // GOOGLE DETECTOR
    if(eregi("Googlebot",$HTTP_USER_AGENT))
    {mail("email@domain.com", "GOOGLE detected", "Google crawled $url at $today");}

    // YAHOO DETECTOR
    elseif(eregi("YahooSeeker",$HTTP_USER_AGENT))
    {mail("email@domain.com", "YAHOO detected", "Yahoo crawled $url at $today");}

    // AELXA DETECTOR
    elseif(eregi("ia_archiver",$HTTP_USER_AGENT))
    {mail("email@domain.com", "ALEXA detected", "ALEXA crawled $url at $today");}

    // MIRAGO DETECTOR
    elseif(eregi("HenryTheMiragoRobot",$HTTP_USER_AGEN T))
    {mail("email@domain.com", "MIRAGO detected", "Mirago crawled $url at $today");}
    ?>

  7. #7
    Affiliate Marketeer

    Status
    Offline
    Join Date
    Aug 2003
    Location
    Manchester
    Posts
    855
    Thanks
    26
    Thanked 15 Times in 13 Posts
    Umm, looks ok to me.

    Suppose the only way to test it, is to add it to your pages and hope they come along.

    You could add 'Xenu's Link Sleuth 1.1b' to the list and run the Xenu link sleuth prog to see if accepts more than 1 bot.

    Let me know, hoe you get on.



Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Feed Insertion PHP script?
    By stevenm in forum Programming
    Replies: 3
    Last Post: 30-12-04, 01:56 PM
  2. eBay Api PHP Script
    By scifind in forum Programming
    Replies: 1
    Last Post: 08-10-04, 03:10 PM
  3. Can I run a php script as a cron job?
    By rogerlittin in forum Programming
    Replies: 9
    Last Post: 17-12-03, 10:20 PM
  4. Grabbing script help php 4.3.2
    By Keith in forum Programming
    Replies: 3
    Last Post: 18-08-03, 07:46 AM
  5. PHP Script error problem
    By Edward in forum Programming
    Replies: 1
    Last Post: 16-08-03, 04:45 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
To Top

Content Relevant URLs by vBSEO 3.5.0 RC2