Jump to content

Google Hunter...


phpretard

Recommended Posts

I am trying to catch that waskaly googlebot crawling my site. 

 

Evidently they have lots of IP addresses and whois says the range is 66.249.64.0 - 66.249.95.255.

 

Please help me with the code below.

 

<?

$ip=$_SERVER['REMOTE_ADDR'];

if($ip=='RANGE OF IPS'){

echo "Caught ya";

?>
}

 

Thank you.

 

-Anthony

Link to comment
Share on other sites

You could also catch 'em by looking at $_SERVER['HTTP_USER_AGENT'], not the way you asked but another method, here's some random agents from my logs:

Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)

msnbot-media/1.0 (+http://search.msn.com/msnbot.htm)

Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)

Gigabot/3.0 (http://www.gigablast.com/spider.html)

msnbot/1.0 (+http://search.msn.com/msnbot.htm)

IRLbot/3.0 (compatible; MSIE 6.0; http://irl.cs.tamu.edu/crawler)

 

I'd also recommend a look here: http://www.robotstxt.org/

Link to comment
Share on other sites

I have no idea what that code reads but I am going to use it.

 

Thank you!!

 

First, it splits the IP into it's 4 parts. Then, tests for the case where the first part is 66, the second is 249, and the third is between 64 and 95. The forth part is irrelevant if they own everything in the 0-255 range.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.