DEV Community

IP Location API by
IP Location API by

Posted on

IP Geolocation & IP Location Lookup API

The service IP Geolocation is free for the test and small applications and sites.

Due to powerful and optimized servers located on different continents and productive database, achieve a real response of up to 90 milliseconds in most parts of the world.

PHP Library
Go to Github Project

PHP Function

$location = get_ipwhois($ip);
$decodedLocation = json_decode($location, true);

echo "<pre>";
echo "</pre>";

function get_ipwhois($ip, $format = "json", $lang = "en") {
    $url = "".$format."/".$ip."?lang=".$lang;
    $cURL = curl_init();

    curl_setopt($cURL, CURLOPT_URL, $url);
    curl_setopt($cURL, CURLOPT_HTTPGET, true);
    curl_setopt($cURL, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($cURL, CURLOPT_HTTPHEADER, array(
        'Content-Type: application/json',
        'Accept: application/json'
    return curl_exec($cURL);
Enter fullscreen mode Exit fullscreen mode

Top comments (1)

nag323 profile image

Great. Thanks for sharing. also provides powerful IP Location Lookup API