I have a dropdown in which i fetch country name from database and i want to select current country name based on there ip address in dropdown box
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
MaxMind GeoIP has a free API for PHP for finding someone's country based on their IP.
You'll have to use an IP Geolocation web service. Most of them are paid, but they provide some (usually limited) free access as well.
I have used http://www.maxmind.com/ and http://ipinfodb.com/ successfully in the past and a friend has good things to say about http://www.geoplugin.com/
system('traceroute ' . $trace_ip_addr); // Trace IP address.
Use PHP GeoIP API. NOTE: you need to setup the Maxmind GeoIP API database before you can use the functions.