Skip to content

Instantly share code, notes, and snippets.

@thiagotmendes
Created July 3, 2019 15:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thiagotmendes/8e3ebf9624daa3c30e809092d4134d79 to your computer and use it in GitHub Desktop.
Save thiagotmendes/8e3ebf9624daa3c30e809092d4134d79 to your computer and use it in GitHub Desktop.
<?php
$user_ip = getenv('REMOTE_ADDR');
$geo = unserialize(file_get_contents("http://www.geoplugin.net/php.gp?ip=$user_ip"));
var_dump($geo);
$pais = $geo["geoplugin_countryName"];
$cidade = $geo["geoplugin_city"];
$estado = $geo['geoplugin_region'];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment