phpretard Posted February 19, 2008 Share Posted February 19, 2008 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 More sharing options...
phpretard Posted February 19, 2008 Author Share Posted February 19, 2008 anyone? Link to comment https://forums.phpfreaks.com/topic/91888-google-hunter/#findComment-470552 Share on other sites More sharing options...
rhodesa Posted February 19, 2008 Share Posted February 19, 2008 <?php $parts = explode('.',$_SERVER['REMOTE_ADDR'],4); if($parts[0] == 66 && $parts[1] == 249 && $parts[2] >= 64 && $parts[2] <= 95){ echo "Caught ya"; } ?> Link to comment https://forums.phpfreaks.com/topic/91888-google-hunter/#findComment-470561 Share on other sites More sharing options...
phpretard Posted February 19, 2008 Author Share Posted February 19, 2008 I have no idea what that code reads but I am going to use it. Thank you!! Link to comment https://forums.phpfreaks.com/topic/91888-google-hunter/#findComment-470574 Share on other sites More sharing options...
tinker Posted February 19, 2008 Share Posted February 19, 2008 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 More sharing options...
rhodesa Posted February 19, 2008 Share Posted February 19, 2008 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 More sharing options...
phpretard Posted February 19, 2008 Author Share Posted February 19, 2008 Thank you!!! Now I get to hunting that Waskely Wobot. HEHEHEHEH Link to comment https://forums.phpfreaks.com/topic/91888-google-hunter/#findComment-470719 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.