php - How can I get US State from GeoIP2? -


is there way, how state abbr. (ca, vi, ..) ip?

the library return me metro code , postal code, there lookup table state convertor? or how extract state?

you need in subdivisions section, generic container states, provinces, etc. depending on country.

if you're using web api, here docs, , relevant chunk output example:

"subdivisions":  [     {         "confidence":  50,         "geoname_id":  5332921,         "iso_code":    "ca",         "names":  {             "de":    "kalifornien",             "en":    "california",             "es":    "california",             "fr":    "californie",             "ja":    "カリフォルニア",             "ru":    "Калифорния",             "zh-cn": "加州"         }     } ] 

the php client using downloaded ip db has mostspecificsubdivision:

print($record->mostspecificsubdivision->name . "\n"); // 'minnesota' print($record->mostspecificsubdivision->isocode . "\n"); // 'mn' 

Comments

Popular posts from this blog

php - Admin SDK -- get information about the group -

dns - How To Use Custom Nameserver On Free Cloudflare? -

Python Error - TypeError: input expected at most 1 arguments, got 3 -