I want to put together a PHP script to resolve city name (nothing else is needed) with a good resolution just for a single country (IRAN). As I have to query the DB for multiple times, its better to go through a downloadable local version. I have read most of posts on stackoverflow and since now I have tested these:
Any good idea would be really appreciated.
This is a tough one and hard to do reliably. I have given it a go in the past and it went something like this
There are paid for services that can do this really quickly for you. It might take you ages to get something working that is still unreliable because you simply do not have the data. I would seriously consider http://www.maxmind.com/en/city_per - unless of course this is a completely none commercial project and $ is a no no.
If you can get the lat and long from an IP table, even without the city data then you may want to then use something like this to check for the nearest city of Javascript is an optio n - Finding nearest listed (array?) city from known location.
What about the browsers Share Location feature?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With