php - find ip address in codeigniter -
i tried add geolocation on site customer current location want ip address did not get.
<?php include('doctype.php');?> <header> <?php include('topheader.php');?> <?php include('searcharea.php');?> </header> <?php include('nav.php');?> <div class="container"> <section> <?php $b=get_client_ip(); echo $b; function get_client_ip() { $ipaddress = ''; if($_server['remote_addr']) $ipaddress = $_server['remote_addr']; else $ipaddress = 'unknown'; return $ipaddress; }?> </section> </div> <?php include('footer.php');?>
this code tried ip address geolocation. did know geolaction example customer current city.
best way of current location using geolocation
use below client current location latitude & longitude
<!doctype html> <html> <body onload="getlocation()"> <script> function getlocation() { if (navigator.geolocation) { navigator.geolocation.getcurrentposition(showposition); } else { alert("geolocation not supported browser."); } } function showposition(position) { alert("latitude: " + position.coords.latitude + "\n longitude: " + position.coords.longitude); } </script> </body> </html>
this latitude , longitude based display google map marker
Comments
Post a Comment