Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Arno Welzel Newsgroups: comp.lang.php,alt.php Subject: Re: recognize country Date: Sun, 15 Dec 2013 15:22:45 +0100 Lines: 87 Message-ID: <52ADBB35.5080504@arnowelzel.de> References: <125kyzt66kwku$.q6ywosnout0r.dlg@40tude.net> <461fsbu98jld.1vftfxn0dl3dg.dlg@40tude.net> <10m4kg1lqaghb$.1qos4ncc1tq11$.dlg@40tude.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: individual.net QtWLEzAaS8jhRQljjt4VhgHlKRJgzn+gs5EamSLG1wmeO4Vtuv Cancel-Lock: sha1:+wDgGq+9xQ7FLC14MVXTA4bPnv0= User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 In-Reply-To: <10m4kg1lqaghb$.1qos4ncc1tq11$.dlg@40tude.net> X-Enigmail-Version: 1.6 Xref: csiph.com comp.lang.php:12249 nawfer, 2013-12-15 11:34: >>> GeoIP. >> >> Which is just as accurate as any other IP-based location service. IOW, >> not very. > > but is a online service or one php array or both > ? > > > but isn't stable the ip of the nations? > example > 50.xxx.xxx.xxx to 100.xxx.xxx.xxx all ip nation A > 101.xxx.xxx.xxx to 150.xxx.xxx.xxx all ip nation B > 151.xxx.xxx.xxx to 200.xxx.xxx.xxx all ip nation C No - it does not work that way. > ok the ip inner nations ip can't be accurate and can to change, but between > nation is table (every range is assigned at only one nation)? No. IP ranges are assigned to providers - and providers can operate in multiple countries. And by the way - there is also IPv6. But you still did not answer what you want to achieve. If you want to handle different languages, you should better use the Accept-Language header oft the browser - and even then the visitor should be able to manually select the language, just in case the browser does not send an Accept-Language header at all or there is no "known" language in the list of accepted languages. Also see: And for example - if you have content in English, French in Italian and you want to deliver it depending on the users browser settings (yes, the quality value of each language is ignored, since literally all browsers send the preferred languages in the order of preference): BTW: You can see this in action on my private site . The code is not identical, but very similar. The site will redirect to the English or German version depending on what language the browsers prefers or defaults to German if no "known" language was given. However it is always possible to change the language using the "language" links in the header. -- Arno Welzel http://arnowelzel.de http://de-rec-fahrrad.de