How to get a user's general information, ip and geolocation

There are many variables predefined in the system that will return useful information about the user. Geolocation The following session variables are available, note that these values remain constant while the session is active. Even of the IP changes, the system will remember the first IP recorded when the session was opened.
How to get a user's general information, ip and geolocation
How to get a user's general information, ip and geolocation

IP Geolocation Sessions

The following session variables are available, note that these values remain constant while the session is active. Even of the IP changes, the system will remember the first IP recorded when the session was opened.

 

$_SESSION['ip2location']
$_SESSION['userIP']
$_SESSION['country_iso_code']
$_SESSION['country_name']
$_SESSION['region_nameIP']
$_SESSION['city_nameIP']
$_SESSION['postal_codeIP']
$_SESSION['latitudeIP']  
$_SESSION['longitudeIP']
$_SESSION['ISPIP']

 

You can also use the ip2locationXP class already initilaiezed at runtime, the reason why we have both is because the class will only check the IP geolocation from various APIs once and save the information in sessions, this improves speed and reduced API calls:

$ipLocation->getStatus()
$ipLocation->getIP()
$ipLocation->getCountry()
$ipLocation->getCountryCode()
$ipLocation->getRegion()
$ipLocation->getCity()
$ipLocation->getPostalCode()
$ipLocation->getLatitude()
$ipLocation->getLongitude()
$ipLocation->getISP()

Comments

Get a Quote

Get a Quote