Log In Register
c
Get city, region, country, latitude and longitude from IP address PHP using free API:

<?php
$ip = '123.45.67.89';
$data = json_decode(file_get_contents('http://api.rest7.com/v1/ip_to_city.php?ip=' . $ip));

if (@$data->success !== 1)
{
    die('Failed');
}
echo 'City=' . $data->city . '<br>';
echo 'Region=' . $data->region . '<br>';
echo 'Country=' . $data->country . '<br>';
echo 'Latitude=' . $data->lat . '<br>';
echo 'Longitude=' . $data->lng . '<br>';