Go to most recent revision |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
<?php
function IPtoCoordinates($ip)
{
// $dom = new DOMDocument();
if($ipcheck == -1 || $ipcheck === false)
trigger_error('Invalid IP, what are you doing? :|', E_USER_ERROR);
else
$uri = 'http://freegeoip.net/json/' . $ip;
$location = $data['country_name'];
$longitude = $data['longitude'];
$latitude = $data['latitude'];
/*
$uri = 'http://freegeoip.net/xml/' . $ip;
$dom->load($uri);
$location = $dom->getElementsByTagName('CountryName')->item(0)->nodeValue;
$longitude = $dom->getElementsByTagName('Longitude')->item(0)->nodeValue;
$latitude = $dom->getElementsByTagName('Latitude')->item(0)->nodeValue;
*/
return array('location' => $location, 'longitude' => $longitude, 'latitude' => $latitude);
}
?>