I've written a component for downloading files from my website and it also writes data to the database about the downloading of files. To understand where the downloading users are from, I want to save their IP and Country.

To get IP I use:

JFactory::getApplication()->input->server->get('REMOTE_ADDR', '');

I don't know how to get the country. In "Joomla! Debug console -> Session" Country is present.

  • Out of the box Joomla does not store visitor's country, nor does it have an API for this purpose. If you can see it in session, it must be some 3rd party extension doing it. If this session data can be relied on, you can use the Session API to access it. Otherwise, it's totally up to you how to get such data. As already mentioned, Joomla has no API for this. You'd have to use an external library like GeoIP.
    – Sharky
    Apr 21 at 8:50


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.