IP to Country

Hello,

I’ve created a PHP script (combined with a MySQL database) that looks up the country for the ip address.

Can you guys check and see if your country is displayed correctly?

http://www.ballot-box.net/test/ip2country.php

It got mine correct :slight_smile:

Got mine right as well.

Is this code you are going to be releasing?

Yep

Got mine correct as well. Don’t forget if needed to test against someone who uses a proxy in a country different from their own

Works for me.

Works for me.

That’s amazing. Can you narrow it down by state, city?

Download a free database to do it, lampcms.com; I dont recall if MaxMind give a free version of their city database, but they certainly do the country level and i think the state level.

Every IPv4 address can be represented as an unsigned 32-bit integer; as IP’s are assigned by block, any IP can be tracked down using such a database and a simple BETWEEN comparison.

Yep works in Fr.