Freegeoip
Once installed and auto-enabled, the plugin will request IP address based geolocation information from your site's visitors and add that information to their Joomla user session. Access that information as follows $session = JFactory::getSession(); $session->get('freegeoip_ip');
Available session variables are:
freegeoip_ip
freegeoip_country_code
freegeoip_country_name
freegeoip_region_code
freegeoip_region_name
freegeoip_city
freegeoip_zipcode
freegeoip_latitude
freegeoip_longitude
freegeoip_metro_code
freegeoip_area_code
API usage is limited to 10,000 queries per hour. After reaching this limit, all requests will result in HTTP 403 (Forbidden) until the roll over.
Visit freegeoip.net for more information on their service and how you can host your own instance of this system.