این کد بر اساس IP بهتون اطلاعات میده
<php echo var_export(unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip='.$_SERVER['REMOTE_ADDR'])));?>
این کد هم توسط بروزر از کاربر اجازه میگیره و موقعیتش رو نمایش میده
کد HTML:
<html><body> <p>Click the button to get your coordinates.</p> <button onclick="getLocation()">Try It</button> <p id="demo"></p> <script>var x = document.getElementById("demo"); function getLocation() { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(showPosition); } else { x.ierHTML = "Geolocation is not supported by this browser."; }} function showPosition(position) { x.ierHTML = "Latitude: " + position.coords.latitude + "<br>Longitude: " + position.coords.longitude;}</script> </body></html>