Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $lines = file('GeoIPCountryWhois.csv');
- $lastIP = 0;
- $lastCountry = '';
- $fileC = -1;
- $data = array();
- foreach ($lines as $line_num => $line)
- {
- $info = explode(",", $line, 6);
- $iIP = trim($info[2], '"');
- $iC = trim($info[4], '"');
- if(bcdiv($iIP, 100000000, 0) != $fileC)
- {
- $fileC = bcdiv($iIP, 100000000, 0);
- $data[$fileC][$lastIP] = $lastCountry;
- }
- $data[$fileC][$iIP] = strtolower($iC);
- $lastIP = $iIP;
- $lastCountry = strtolower($iC);
- }
- echo "<pre>".print_r($data, 1)."</pre>";
- ?>
Add Comment
Please, Sign In to add comment