dragonusthei Posted December 6, 2006 Share Posted December 6, 2006 Hello,How can i detect whitch country a user comes from?Thanks. Link to comment https://forums.phpfreaks.com/topic/29677-country-detection/ Share on other sites More sharing options...
joquius Posted December 6, 2006 Share Posted December 6, 2006 There are many scripts on the net with IP directories. Search for them on Google. Link to comment https://forums.phpfreaks.com/topic/29677-country-detection/#findComment-136198 Share on other sites More sharing options...
dragonusthei Posted December 6, 2006 Author Share Posted December 6, 2006 But how would you do this on the fly?is there no simple way using http codes? Link to comment https://forums.phpfreaks.com/topic/29677-country-detection/#findComment-136201 Share on other sites More sharing options...
joquius Posted December 6, 2006 Share Posted December 6, 2006 There's no HTTP string which relates to your locale. You need to get an IP directory. Link to comment https://forums.phpfreaks.com/topic/29677-country-detection/#findComment-136203 Share on other sites More sharing options...
dragonusthei Posted December 6, 2006 Author Share Posted December 6, 2006 can you recommend any and is this gonna cost me? Link to comment https://forums.phpfreaks.com/topic/29677-country-detection/#findComment-136221 Share on other sites More sharing options...
joquius Posted December 6, 2006 Share Posted December 6, 2006 There are loads of free ones just "Search for them on Google." Link to comment https://forums.phpfreaks.com/topic/29677-country-detection/#findComment-136223 Share on other sites More sharing options...
SharkBait Posted December 6, 2006 Share Posted December 6, 2006 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 More sharing options...
dragonusthei Posted December 6, 2006 Author Share Posted December 6, 2006 Hi if you could post that it would be fantastic. Link to comment https://forums.phpfreaks.com/topic/29677-country-detection/#findComment-136330 Share on other sites More sharing options...
Orio Posted December 6, 2006 Share Posted December 6, 2006 Just google!Here's one I found by [b]Googling[/b]:http://www.brothersoft.com/web_author/site_management/maxmind_geolite_country_database_42917.htmlI am sure there are better ones out there... (it has lots of IPs, but it didnt have mine for an example)Orio. Link to comment https://forums.phpfreaks.com/topic/29677-country-detection/#findComment-136337 Share on other sites More sharing options...
dragonusthei Posted December 6, 2006 Author Share Posted December 6, 2006 Ok so i have a .cvs file how do i make that go into my database? Link to comment https://forums.phpfreaks.com/topic/29677-country-detection/#findComment-136339 Share on other sites More sharing options...
makeshift_theory Posted December 6, 2006 Share Posted December 6, 2006 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 More sharing options...
dragonusthei Posted December 6, 2006 Author Share Posted December 6, 2006 there is no import button ........... Link to comment https://forums.phpfreaks.com/topic/29677-country-detection/#findComment-136490 Share on other sites More sharing options...
dragonusthei Posted December 7, 2006 Author Share Posted December 7, 2006 so do i just run that code in mysql? Link to comment https://forums.phpfreaks.com/topic/29677-country-detection/#findComment-136548 Share on other sites More sharing options...
Daniel0 Posted December 7, 2006 Share Posted December 7, 2006 Yes. Link to comment https://forums.phpfreaks.com/topic/29677-country-detection/#findComment-136551 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.