GET Location from ip in php

   $ip = ‘117.197.234.146’;

$details = json_decode(file_get_contents(“http://ipinfo.io/{$ip}/json”));
echo $details->city; // -> “Mountain View”

return
stdClass Object
(
[ip] => 117.197.234.146
[city] => Bhubaneshwar
[region] => Odisha
[country] => IN
[loc] => 20.2724,85.8338
[org] => AS9829 National Internet Backbone
[postal] => 752115
[timezone] => Asia/Kolkata
[readme] => https://ipinfo.io/missingauth
)

Leave a Comment

Your email address will not be published. Required fields are marked *