IP Geolocation is free for non commerical use api key not required this is usefull for website knowing the detail of users location on your website it is easy to code . fast and secure available in all format like JSON, PHP, CSV, XML
There are many company providing geo location data but its to costly but ip-api.com geolocation is free for small use ip-api.com geolocation API provide details like Ip , city , country , longitude , latitude , zip code , isp etc. Many developers are using this service for users location.
<!DOCTYPE html>
<html>
<head>
<title>IP Geo Location</title>
</head>
<body>
<h1>Ip Geo Location in PHP</h1>
<?php
$ch =curl_init();
curl_setopt($ch, CURLOPT_URL, "http://ip-api.com/json");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result=curl_exec($ch);
$result=json_decode($result);
if ($result->status=='success') {
echo "IP Address:".$result->query.'<br/>';
echo "Country:".$result->country.'<br/>';
echo "City:".$result->city.'<br/>';
echo "Timezone:".$result->timezone.'<br/>';
echo "Region:".$result->region.'<br/>';
echo "Lat:".$result->lat.'<br/>';
echo "lon:".$result->lon.'<br/>';
echo "Zip:".$result->zip.'<br/>';
}
?>
</body>
</html>