You can use the Geo IP Location extension of PHP.

Please see the link below:

http://php.net/manual/en/book.geoip.php