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

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

python - Pygame screen.blit not working -

c# - Web API response xml language -