title: Reliable city level Geo-IP, free local database
body: <p>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:</p>
  
  <ul>
  <li><a href="http://www.maxmind.com/en/city">GeoIP City</a> from maxmind sounds good, but is not free.</li>
  <li><a href="http://dev.maxmind.com/geoip/legacy/downloadable/">GeoIP</a> from maxmind, has a low level of accuracy (about 50-60%)</li>
  <li><a href="http://www.ip2country.net/ip2country/IP-COUNTRY-REGION-CITY.html">ip2country.net</a> has an IP-2-City Database but not free and does not resolve city names for Iran.</li>
  <li>I also tried the <a href="http://lite.ip2location.com/database-ip-country-region-city">DB#.Lite</a> from ipinfodb.com which has an API <a href="http://ipinfodb.com/ip_location_api.php">here</a> without any success. The problem is that, it does not detect many city names.</li>
  <li>I also tried <a href="http://www.hostip.info/use.html">hostip.info API</a>, but it seems to be too slow.</li>
  <li>There is a <a href="http://phpweby.com/downloads/ip2country">free php class</a> with local DB which resolves only the country name.</li>
  <li>I dont know if there is chance, using Piwik with <a href="http://dev.piwik.org/trac/ticket/45">this GeoIP plugin</a>. It would be appreciated to have ideas if someone knows about it.</li>
  <li><a href="http://ipinfo.io">ipinfo.io</a> is another service which does not resolve city names with accuracy.</li>
  <li>I dont know if there is a way to use Google analytics to resolve city names, as I think google would be better than any other service regarding countries like Iran.</li>
  </ul>
  
  <p>Any good idea would be really appreciated.</p>