joomla:iplocation:developers

Developers Documentation on IP-Location for Joomla!

IP-Location stores its data in the Joomla! global variable $mainframe, and is accessible throughout the Joomla! Framework:

Code Example for getting IP-Location data

function SomeFunction()
{
	global $mainframe;
 
	// Get Location Data
	$location = $mainframe->get('iplocation', null);
}


The Location Data will be false if no IP Address has been detected or no IP Location data was found for the IP Address.
The Location Data will be null if locationing has not yet been performed.

Determining the IP Location data is performed after initialization of the Joomla! Framework.

The Location Data is arranged as Array with following structure:

Array structure for Location Data

['ip']             ... The clients IP Address
['useragent']      ... The clients user agent string
['country_code']   ... Country Code
['country_name']   ... Country Name
['region_name']    ... Region Name, 'false' if only Country detected.
['city']           ... City, 'false' if only Country detected.
['zippostalcode']  ... ZIP or Postal Code, 'false' if only Country detected.
['latitude']       ... Latitude (of City), 'false' if only Country detected.
['longitude']      ... Longitude (of City), 'false' if only Country detected.
['gmtoffset']      ... GMT Offset (of City), 'false' if only Country detected.
['dstoffset']      ... Daylight Savings Time Offset (of City), 'false' if only Country detected.