   [web] Visitor by country in PHP
  Hi all!Recently I made one web page that is made in four languages. I would like to make that if visitor is coming from Germany, web page is displayed in German language. How can I determine which visitor came from which country?Thanks in advance.   
  You would need an IP to Country database listing.  You could pull the users IP from the $_SERVER variable in PHP, then look up where their from in the database.  I can't say I've ever done this, but it should work in theory.   ;  Hm. Ok. I understand that, but I need just ip range for 3-4 countries. Is there some web page from which I can get that info?   ;  At software77.net. It was the first hit on "Free IP-to-country database". They're really useful you know, these search engine thingamajingies :-)   ;Quote:Original post by SanderAt software77.net. It was the first hit on "Free IP-to-country database". They're really useful you know, these search engine thingamajingies :-)I googled before I had post. I found few databases also but they were awfully big. I need just ip-s from 4 countries :D not database of few megabyte.Anyway thanks, this looks very good.   ;Quote:Original post by streamerQuote:Original post by SanderAt software77.net. It was the first hit on "Free IP-to-country database". They're really useful you know, these search engine thingamajingies :-)I googled before I had post. I found few databases also but they were awfully big. I need just ip-s from 4 countries :D not database of few megabyte.Anyway thanks, this looks very good.Of course you can always delete the records of the countries you're not interested in. But unless you're really running out of disk space, I wouldn't bother. Having an index on the IP column which datatype is probably an simple unsigned integer, querying should be really fast.Alternatively you can attempt to detect the browser language, which doesn't say anything about the request origin but may be sufficient for selecting a default language.   ;Quote:Original post by streamerRecently I made one web page that is made in four languages. I would like to make that if visitor is coming from Germany, web page is displayed in German language. How can I determine which visitor came from which country?Don't. This would mean deciding what languages your visitors want to read, which is extremely annoying. Let your visitors decide for themselves: $_SERVER['HTTP_ACCEPT_LANGUAGE']. If a visitor from Germany doesn't have 'de' set as his primary accepted language, it's very likely that he either has other language preferences (which you should respect, instead of defaulting to German), or doesn't want to be traced as being from Germany for privacy reasons (and it would be rude to trace him nonetheless).   ;  Also, there are countries where not all people speak the same language.kind regardsUncle   ;Quote:Original post by ToohrVykQuote:Original post by streamerRecently I made one web page that is made in four languages. I would like to make that if visitor is coming from Germany, web page is displayed in German language. How can I determine which visitor came from which country?Don't. This would mean deciding what languages your visitors want to read, which is extremely annoying. Let your visitors decide for themselves: $_SERVER['HTTP_ACCEPT_LANGUAGE']. If a visitor from Germany doesn't have 'de' set as his primary accepted language, it's very likely that he either has other language preferences (which you should respect, instead of defaulting to German), or doesn't want to be traced as being from Germany for privacy reasons (and it would be rude to trace him nonetheless).This looks good. Even better than IP lookup. I don't mean to be rude and not respecting peoples privacy. Just, for example, there are lot of people that doesn't speak any foreign language, and I would like to give them a fast start, representing web page in their native (or preferred sounds much better) language.;Quote:Original post by ToohrVykQuote:Original post by streamerRecently I made one web page that is made in four languages. I would like to make that if visitor is coming from Germany, web page is displayed in German language. How can I determine which visitor came from which country?Don't. This would mean deciding what languages your visitors want to read, which is extremely annoying. Let your visitors decide for themselves: $_SERVER['HTTP_ACCEPT_LANGUAGE']. If a visitor from Germany doesn't have 'de' set as his primary accepted language, it's very likely that he either has other language preferences (which you should respect, instead of defaulting to German), or doesn't want to be traced as being from Germany for privacy reasons (and it would be rude to trace him nonetheless).Awesome!IE seems to follow the Windows regional settings, but I can't seem to find any place to change it in Firefox?   