[$_GET] 500+ Google Datacenter IP's CSV

niggles

Newbie
Joined
May 23, 2009
Messages
38
Reaction score
14
I saw a list of 500+ Google data center IP's here -> http://www.seo-scoop.com/2006/06/23/current-known-google-datacenter-ip-list/

So I've turned it into a CSV file and attached it.

For those of you interested, it was pretty easy to extract the list from the HTML. I just saved the HTML which had the list and then ran this code over it instead of spending ages doing it by hand.


PHP:
$myString ='1. 64.233.161.18<br />
2. 64.233.161.19<br />etc....';

$myStringArray = array();
// add a pipe to keep end of record
$myString = str_replace('<br />', '|', $myString);
// get rid of new lines
$myString = str_replace("\r", '', $myString);
// explode to array so we can work with each record
$myStringArrayTemp = explode(" " , $myString);
// strip out the 1., 2. sequential numbering
for($i=1;$i<520;$i++){
    
    if($i<9){
    
        $myStringArray[] = substr($myStringArrayTemp[$i], 0, -3);
    } 
    
    if($i>=9 and $i< 99){
    
        $myStringArray[] = substr($myStringArrayTemp[$i], 0, -4);
    }
    
    if($i>=99){
    
        $myStringArray[] = substr($myStringArrayTemp[$i], 0, -5);
    
    }
}
// implode to comma delimited
$final = implode(",", $myStringArray);
echo $final;
 

Attachments

If you want to do lots of automated queries to Google, you can't send more than a couple of queries in a short time before it gives an error message stating you might be using a bot.

By choosing a random datacenter each time from the list you could make a bunch of queries without throwing up the error.

Cheers,
Niggles
 
Thanks for sharing :), here is another code useful for scrapping ips
PHP:
<?php
set_time_limit(0);
$url = "http://www.seo-scoop.com/2006/06/23/current-known-google-datacenter-ip-list/";
$data = file_get_contents($url) or die("ERROR");
preg_match_all('/(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:[.](?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}/si',$data,$matchs);
foreach($matchs[0] as $ip) {
	echo '"'.ip2long($ip).'","'.$ip.'","'.gethostbyaddr($ip)."\"\n";
}
?>
 
That's much cleaner than mine! I hate preg_match (mainly because I don't understand it), but I know I could have stripped all those URL's in 1 line of code instead of lots!!!

Cheers,
Niggles
 
Back
Top