N
N
Nohaga2019-03-30 16:54:27
1C-Bitrix
Nohaga, 2019-03-30 16:54:27

Why doesn't geoip work?

$ip = \Bitrix\Main\Service\GeoIp\Manager::getRealIp(); 
$geoIpData = \Bitrix\Main\Service\GeoIp\Manager::getDataResult($ip,'ru');
$cityName = \Bitrix\Main\Service\GeoIp\Manager::getCityName($ip,'ru');

GEOip is installed, Desktop - Settings - Product settings - Geolocation, it says that it is active, although there are no settings for it in the module settings.
$ip is determined by the code above, but $cityName is not, an empty variable, what could be the reasons? The country is also not defined.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Kudis, 2019-04-01
@kudis

I hasten to disappoint you, all IP-based geolocation is akin to astrology - the accuracy is the same.
You need to check which module you have active here: `/bitrix/admin/geoip_handlers_list.php`
Probably the modules are inactive, or the active module does not adhere to the interface, or you have exhausted the free limit and you need to enter a token.
Write, I can help with the integration of some open directory!
But, I repeat, only users of terrestrial providers can be detected by IP. The lion's share of clients comes from OpSoSov, and there IP does not mean anything.

E
Evgeny Nikolaev, 2019-09-25
@nikolaevevge

Here is a simple library for implementing GeoIp in Bitrix, without limits and with a simple setup blog.ivru.net/?id=82

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question