Jump to content

Country Detection


dragonusthei

Recommended Posts

There are free databases. Look for Ip2Country they offer a database (cvs file) that you can use and do your queries against.

You need to find the numeric representation of the customers IP address via a formula.  I do it for my employer's website to show various product that is only legally allowed to use in their country.

If you can find the ip2country database, I can look and post my code for looking up the area based on their IP.
Link to comment
https://forums.phpfreaks.com/topic/29677-country-detection/#findComment-136247
Share on other sites

I'm assuming your using a mysql database, if so then open up your database in phpmyadmin and click import then click import from csv.  Or if if you want to do it from the command line:
[code]LOAD DATA INFILE 'filename.csv' replace INTO TABLE {tablename} FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (examplefield1,examplefield2,examplefield3);
[/code]
I belive that's right if I remember my SQL commands, someone correct me if I'm wrong, don't like giving bad info =).

Link to comment
https://forums.phpfreaks.com/topic/29677-country-detection/#findComment-136450
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.