Documentation

getCityName

string|null public static
\Bitrix\Main\Service\GeoIp\Manager::getCityName(
 string $ip = '',
 string $lang = ''
);

Static method returns full city name.

Parameters

ParameterDescriptionVersion
$ipIP address.
$langlanguage ID.

Examples

Gets city name for current IP address:

echo \Bitrix\Main\Service\GeoIp\Manager::getCityName();
>>New York

When there is no data - returns empty string.

For directly specified IP:

echo \Bitrix\Main\Service\GeoIp\Manager::getCityName('78.81.165.248');
>> New York 

For directly specified IP and language:

echo \Bitrix\Main\Service\GeoIp\Manager::getCityName('78.81.165.248', 'en');
>> New York 


© «Bitrix24», 2001-2024
Up