stevebauman / location

Detect a users location by their IP Address.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How can I get the country name?

nunuyoo opened this issue · comments

Hello,

I have use the package but I didn't get the country

For Eg:
$position = \Location::get('2.16.163.255');
print_r($position);

will output

Stevebauman\Location\Position Object
(
[countryName] =>
[countryCode] => EU
[regionCode] =>
[regionName] =>
[cityName] =>
[zipCode] =>
[isoCode] =>
[postalCode] =>
[latitude] => 47.0000
[longitude] => 8.0000
[metroCode] =>
[areaCode] =>
[driver] => Stevebauman\Location\Drivers\IpInfo
)

From the result I can understand that it is an EU country, but can I get the country name ?

Hi @nunuyoo, apologies for the long response.

It completely depends on which driver you're using and what data is returned from that driver.

Some drivers will return more data, and some will return less.

You could utilize the MaxMind local driver and see what data it returns for the IP address you're retrieving, or just try re-ordering drivers to see which one has more data.

Unfortunately there will be some IP addresses that drivers don't have that much information on.