Closed t3chn0r closed 11 years ago
We provide an array of subdivisions as some countries have multiple levels of ISO regions. However, we do provide a 'mostSpecificSubdivision' attribute that always returns the most specific subdivision available (e.g., a state in the US).
For instance:
$record->mostSpecificSubdivision->name
See http://maxmind.github.io/GeoIP2-php/doc/v0.4.0/class-GeoIp2.Model.City.html for more informatin.
Also, you may want to use:
$record->city->name $record->country->name
These default to English but will use whatever languages you originally provided to the constructor of the database reader or web service client. This is also documented in the API docs that I linked to, but we could probably use a tutorial or more detailed example.
FYI, I added more detailed examples in the README.md file. Thanks for the report.
Thank you @oschwald, really appreciate it! :+1:
I'm using this implementation in Symfony2 project and so far so good. Although I would like to get "City", "State", "Country" from an IP address.
I did a test with my IP address and I was able to get the "City" and the "Country" using the following two objects:
I haven't figure out how to get the "State" though, I'll be more than glad if you can point me to the documentation (if it exists) on how to get the city name.
Regards