GeoIp

use the geoIp in content / sourcer

2 years 4 months ago #58948

Hans Hardeman (ᶜᵘˢᵗᵒᵐᵉʳ)'s Avatar Hans Hardeman (ᶜᵘˢᵗᵒᵐᵉʳ)

It is posible to use the geoip in the content?
eg make a snippet with sourcer and a php call to the geoip plugin to show the country or somthing else from the database?

2 years 4 months ago #58949

Peter van Westen's Avatar Peter van Westen Admin

You can use the Regular Labs GeoIP library.
Take a look at libraries/regularlabs/helpers/assignments/geo.php on how it uses it.

You can do something like:

require_once JPATH_LIBRARIES . '/geoip/geoip.php';
$geo = new GeoIp($ip);
$location = $geo->get();
echo $location->country;

2 years 4 months ago #58951

Hans Hardeman (ᶜᵘˢᵗᵒᵐᵉʳ)'s Avatar Hans Hardeman (ᶜᵘˢᵗᵒᵐᵉʳ)

B) thanks