I want to get the information that where the my website is open, i want to get the country name. how can do it????????????? i'm trying get the country name from ip address but i'm not getting any inforamtion......
I'd use an API, like: http://ipinfo.io function get_ip_details($ip){ $fetch = file_get_contents('http://ipinfo.io/' . $ip); $return = json_decode($fetch); return $return; } $location = get_ip_details($_SERVER['REMOTE_ADDR']); echo 'This IP originates from ' . $location->city . ' in ' . $location->country; PHP:
usually from an ap unless you feel like making a database with all the IP ranges and the state /county in which case if you did you could probably sell that like the aps do. That would be good if it could imported to a database then your site makes no call out to an ap site. But have fun coding all that ..tedium.