I run the service at IPLocate.io, which you can hook into for free with one easy call:
country; // United States
echo $res->continent; // North America
echo $res->latitude; // 37.751
echo $res->longitude; // -97.822
var_dump($res);
The $res
object will contain your geolocation fields like country
, city
, etc.
Check out the docs for more information.