I'm using PHP MaxMind GeoIP
for getting the user's location.
I did download both files to test: GeoLiteCity.dat
and GeoIPCity.dat
Here is My php
code:
$ip = "189.90.207.67";
$gi = geoip_open("data/GeoLiteCity.dat", GEOIP_STANDARD);
$record = geoip_record_by_addr($gi, $ip);
print "Ip: ".$ip."<br>";
print "Country: ".$record->country_name . "<br>";
print "Region: ".$record->region. "<br>";
print "city: ".$record->city . "<br>";
print "latitude: ".$record->latitude . "<br>";
print "longitude: ".$record->longitude . "<br>";
geoip_close($gi);
Result:
Ip: 189.90.207.67 Country: Brazil Region: city: latitude: -23.5477 longitude: -46.6358
The returned coordinates are different from MaxMind:
https://www.maxmind.com/en/geoip-demo
ip: 189.90.207.67
The coordinates that I got in my code from my ISP, that different from
GeoIPCity.dat
which result was empty for all fields.
Why are the results of the site and of my code different?