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
https://forums.phpfreaks.com/topic/91888-google-hunter/
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
https://forums.phpfreaks.com/topic/91888-google-hunter/#findComment-470589
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
https://forums.phpfreaks.com/topic/91888-google-hunter/#findComment-470601
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.