I have coded a very basic GeoIP table and parser for the results. As well as formed a nice little API for it for external use.
Anywho, API information / purchase: http://ikonroi.com/geo_api.cgi
If you would rather use the free built in resolver refer to http://ikonroi.com/geo.cgi
The parser is free open source I made for all but requires my API for use:
Parsed results:
Anywho, API information / purchase: http://ikonroi.com/geo_api.cgi
If you would rather use the free built in resolver refer to http://ikonroi.com/geo.cgi
The parser is free open source I made for all but requires my API for use:
Code:
<?php
error_reporting(0);
##startregion INCLUDE CODE
$geo = new geo;
class geo
{
public function geo_main_int($ip, $key)
{
//CONFIGUATION
$api_url = 'http://ikonroi.com/api/apis.php';
//ENDCONFIG - Leave rest
$api_action = '?api=geo&ip='.$ip."&Key=".$key;
$api = file_get_contents($api_url.$api_action);
if (strpos($api, base64_decode(SVNQOg)) != true) die($api);
$doc = new DOMDocument();
$doc->loadHTML($api);
$divs = $doc->getElementsByTagName('td');
foreach ($divs as $div)
{
if ($div->getAttribute('class') === 'myipaddress')
{
$this->parse = str_replace(']', '<br>', $div->nodeValue);
}
}
}
public function geo_parse($ip, $key)
{
$this->geo_main_int($ip, $key);
$parse2 = str_replace('[', '<br>', $this->parse);
$ip = explode("IP Address:", $parse2);
$this->geo_data[ip] = explode("\n", $ip[1]);
$hostname = explode("Hostname: ", $parse2);
$hostname2 = explode("\n", $hostname[1]);
$this->geo_data[hostname] = explode('Domain To Location', $hostname2[0]);
$country = explode("Country:", $parse2);
$country2 = explode(chr(194), $country[1]);
$this->geo_data_[country] = str_replace(chr(194), '', $country2[0]);
$state = explode("State:", $parse2);
$this->geo_data[state] = explode('City:', $state[1]);
$city = explode("City:", $parse2);
$this->geo_data[city] = explode('Postal:', $city[1]); if (strpos($this->geo_data[city][0], 'ISP:') != false) $this->geo_data[city][0] = "Unknown";
$area = explode("Area:", $parse2);
$this->geo_data[area] = explode('ISP: ', $this->area[1]); if ($this->geo_data[area][0] == NULL) $this->geo_data[area][0] = "Unknown";
$isp = explode("ISP:", $parse2);
$this->geo_data[isp] = explode('Organization:', $isp[1]);
$Organization = explode("Organization:", $parse2);
$this->geo_data[organization] = explode('Time zone:', $Organization[1]);
$Time_zone = explode("Time zone:", $parse2);
$this->geo_data[time_zone] = explode('Additional IP Lookup Info for IP Address:', $Time_zone[1]);
$blacklist = explode("IP Blacklist Check:", $parse2);
$this->geo_data[blacklist] = explode('Blacklist Check', $blacklist[1]);
$speed = explode("Speed:", $parse2);
$this->geo_data[speed] = explode('Check Internet Speed', $speed[1]);
$longlat = explode("Continent Lat/Lon:", $parse2);
$this->geo_data[longlat] = explode('Country Lat/Lon:', $longlat[1]);
$clat = explode("Country Lat/Lon:", $parse2);
$this->geo_data[clat] = explode('City Lat/Lon:', $clat[1]);
$citylat = explode("City Lat/Lon:", $parse2);
$this->geo_data[citylat] = explode('IP Language:', $citylat[1]); if (strpos($this->geo_data[citylat][0], 'Language:') != false) $this->geo_data[citylat][0] = "Unknown";
$iplang = explode("IP Language:", $parse2);
$this->geo_data[iplang] = explode('IP Address Speed:', $iplang[1]); if ($this->geo_data[iplang][0] == NULL) $this->geo_data[iplang][0] = "Unknown";
$cur = explode("IP Currency:", $parse2);
$this->geo_data[cur] = explode('IP Address Speed:', $cur[1]); if ($this->geo_data[cur][0] == NULL) $this->geo_data[cur][0] = "Unknown";
return "<b><font color='orange'>IP:</b></font> " . $this->geo_data[ip][0] . "<br>" . "
<b><font color='orange'>Hostname:</b></font> " . $this->geo_data[hostname][0] . "
<b><font color='orange'>Country:</b></font> " . $this->geo_data_[country] . "<br>" . "
<b><font color='orange'>State:</b></font> " . $this->geo_data[state][0] . "<br>" . "
<b><font color='orange'>City:</b></font> " . $this->geo_data[city][0] . "<br>" . "
<b><font color='orange'>Area:</b></font> " . $this->geo_data[area][0] . "<br>" . "
<b><font color='orange'>ISP:</b></font> " . $this->geo_data[isp][0] . "<br>" . "
<b><font color='orange'>Organization:</b></font> " . $this->geo_data[organization][0] . "<br>" . "
<b><font color='orange'>Time zone:</b></font> " . $this->geo_data[time_zone][0] . "<br>" . "
<b><font color='orange'>Network speed:</b></font> " . $this->geo_data[speed][0] . "
<b><font color='orange'>Black list:</b></font> " . $this->geo_data[blacklist][0] . "
<b><font color='orange'>Continent Lat/Lon:</b></font> " . $this->geo_data[longlat][0] . "<br>" . "
<b><font color='orange'>Country Lat/Lon:</b></font> " . $this->geo_data[clat][0] . "<br>" . "
<b><font color='orange'>City Lat/Lon:</b></font> " . $this->geo_data[citylat][0] . "<br>
<b><font color='orange'>IP Language:</b></font> " . $this->geo_data[iplang][0] . "<br>
<b><font color='orange'>IP Currency:</b></font> " . $this->geo_data[cur][0] . "<br>";
}
}
define('geo_ip', $geo->geo_data[ip][0]);define('geo_hostname', $geo->geo_data[hostname][0]);define('geo_country', $geo->geo_data[country][0]);define('geo_state', $geo->geo_data[state][0]);define('geo_city', $geo->geo_data[city][0]);define('geo_area', $geo->geo_data[area][0]);define('geo_isp', $geo->geo_data[isp][0]);define('geo_organization', $geo->geo_data[organization][0]);define('geo_time_zone', $geo->geo_data[time_zone][0]);define('geo_netspeed', $geo->geo_data[speed][0]);define('geo_blacklist', $geo->geo_data[blacklist][0]);define('geo_continent_Lat_Lon', $geo->geo_data[longlat][0]);define('geo_country_Lat_Lon', $geo->geo_data[clat][0]);define('geo_city_Lat_Lon', $geo->geo_data[citylat][0]);define('geo_ip_lang', $geo->geo_data[iplang][0]);define('geo_ip_currency', $geo->geo_data[cur][0]);
##endregion INCLUDE CODE
$geo_settings[ip] = $_GET[ip];
echo $geo->geo_parse($geo_settings[ip], $_GET[Key]);
$geo->geo_parse($geo_settings[ip], $_GET[Key]);
?>
Parsed results: