Created
December 19, 2019 20:11
-
-
Save thiagotmendes/d3b3a18b22ec9a343e87c6b2eb2470ac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$cidade = "belo horizonte"; | |
echo $_SERVER['HTTP_CLIENT_IP']; | |
$ip = $_SERVER['HTTP_CLIENT_IP']; // your ip address here | |
$query = @unserialize(file_get_contents('http://ip-api.com/php/'.$ip)); | |
if($query && $query['status'] == 'success') | |
{ | |
if($cidade == strtolower($query['city'])){ | |
echo "aqui é BH <br>"; | |
} | |
echo 'Your City is ' . strtolower($query['city']); | |
echo '<br />'; | |
echo 'Your State is ' . $query['region']; | |
echo '<br />'; | |
echo 'Your Zipcode is ' . $query['zip']; | |
echo '<br />'; | |
echo 'Your Coordinates are ' . $query['lat'] . ', ' . $query['lon']; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment