Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #12220 > unrolled thread
| Started by | nawfer <novalidsforspam@alt.al> |
|---|---|
| First post | 2013-12-14 14:43 +0100 |
| Last post | 2013-12-15 15:21 +0000 |
| Articles | 12 on this page of 32 — 13 participants |
Back to article view | Back to comp.lang.php
recognize country nawfer <novalidsforspam@alt.al> - 2013-12-14 14:43 +0100
Re: recognize country Jerry Stuckle <jstucklex@attglobal.net> - 2013-12-14 08:58 -0500
Re: recognize country nawfer <novalidsforspam@alt.al> - 2013-12-15 11:16 +0100
Re: recognize country Jerry Stuckle <jstucklex@attglobal.net> - 2013-12-15 08:37 -0500
Re: recognize country The Natural Philosopher <tnp@invalid.invalid> - 2013-12-14 15:27 +0000
Re: recognize country Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2013-12-14 10:32 -0500
Re: recognize country Christoph Michael Becker <cmbecker69@arcor.de> - 2013-12-14 19:55 +0100
Re: recognize country Jerry Stuckle <jstucklex@attglobal.net> - 2013-12-14 14:52 -0500
Cross-Posting (was: recognize country) Christoph Michael Becker <cmbecker69@arcor.de> - 2013-12-14 21:57 +0100
Re: Cross-Posting Jerry Stuckle <jstucklex@attglobal.net> - 2013-12-14 16:20 -0500
Re: Cross-Posting Christoph Michael Becker <cmbecker69@arcor.de> - 2013-12-14 23:25 +0100
Re: Cross-Posting Jerry Stuckle <jstucklex@attglobal.net> - 2013-12-14 17:36 -0500
Re: Cross-Posting Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-12-14 22:38 +0100
Re: Cross-Posting Christoph Michael Becker <cmbecker69@arcor.de> - 2013-12-14 23:31 +0100
Re: Cross-Posting Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-12-14 23:55 +0100
Re: Cross-Posting Jerry Stuckle <jstucklex@attglobal.net> - 2013-12-14 18:08 -0500
Re: Cross-Posting Christoph Michael Becker <cmbecker69@arcor.de> - 2013-12-15 00:35 +0100
Re: Cross-Posting Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-12-15 01:13 +0100
Re: recognize country richard <noreply@example.com> - 2013-12-14 18:56 -0500
Re: recognize country Jerry Stuckle <jstucklex@attglobal.net> - 2013-12-14 19:09 -0500
Re: recognize country nawfer <novalidsforspam@alt.al> - 2013-12-15 11:34 +0100
Re: recognize country "J.O. Aho" <user@example.net> - 2013-12-15 11:59 +0100
Re: recognize country Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-12-15 12:05 +0100
Re: recognize country Doug Miller <doug_at_milmac_dot_com@example.com> - 2013-12-15 12:51 +0000
Re: recognize country Jerry Stuckle <jstucklex@attglobal.net> - 2013-12-15 08:49 -0500
Re: recognize country Tim Streater <timstreater@greenbee.net> - 2013-12-15 13:13 +0000
Re: recognize country Jerry Stuckle <jstucklex@attglobal.net> - 2013-12-15 08:50 -0500
Re: recognize country Arno Welzel <usenet@arnowelzel.de> - 2013-12-15 15:22 +0100
Re: recognize country The Natural Philosopher <tnp@invalid.invalid> - 2013-12-15 15:35 +0000
Re: recognize country Evan Platt <evan@theobvious.espphotography.com.invalid> - 2013-12-14 21:35 -0800
Re: recognize country Doug Miller <doug_at_milmac_dot_com@example.com> - 2013-12-15 12:42 +0000
Re: recognize country Denis McMahon <denismfmcmahon@gmail.com> - 2013-12-15 15:21 +0000
Page 2 of 2 — ← Prev page 1 [2]
| From | nawfer <novalidsforspam@alt.al> |
|---|---|
| Date | 2013-12-15 11:34 +0100 |
| Message-ID | <10m4kg1lqaghb$.1qos4ncc1tq11$.dlg@40tude.net> |
| In reply to | #12236 |
>> 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 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)?
[toc] | [prev] | [next] | [standalone]
| From | "J.O. Aho" <user@example.net> |
|---|---|
| Date | 2013-12-15 11:59 +0100 |
| Message-ID | <bh5gbtFsu4eU1@mid.individual.net> |
| In reply to | #12240 |
On 15/12/13 11:34, nawfer wrote: >>> 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 > > 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)? > There are IP-numbers which is registred for say Sweden and users in Denmark will be using those IP-numbers, which makes it look like the Dane comes from Sweden and you your case you would server them something in Swedish which ain't Danish. This applies for Hi3G users, sure you could adjust and tell that those IP-numbers should get things in Danish, but then the Swedish users will get it in Danish too. There are quite many such ranges and some companies lets other companies to use part of their range to thir party which may not come from the same country. GeoIP does have quite okey lists, but only if you are paying for it, the free lists has loads of known issues. Sadly you didn't answer Jerrys question, why do you want to do this, detect the users country? -- //Aho
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2013-12-15 12:05 +0100 |
| Message-ID | <2197091.TGfsNCzbWx@PointedEars.de> |
| In reply to | #12240 |
[Removed *non-existing* alt.php from the Newsgroups header field value]
nawfer wrote:
>>> 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
> ?
Once you have learned to write an coherent question, one might be able to
help you.
Please also learn to quote. The attribution lines are relevant as a posting
replied to now can and will expire later.
> but isn't stable the ip of the nations?
No. First of all, nation and country are different subjects. A country can
have, and I daresay by now most countries do have, inhabitants from several
nations. There is also the increasingly likely possibility for a person to
have multiple nationalities.
Second, IP address ranges are allocated to *Regional* Internet Registries
(RIRs), which then allocate them for Local Internet Registries (LIRs). LIRs
include Internet service providers, enterprises, or academic institutions:
<https://en.wikipedia.org/wiki/IPv4#Allocation>
<https://en.wikipedia.org/wiki/IPv6_address#IPv6_address_space>
> 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
This cannot be correct because several address ranges within those ranges
are reserved for special use already:
<https://en.wikipedia.org/wiki/IPv4#Special-use_addresses>
> 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. Why do you want to determine the nation/country?
PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
[toc] | [prev] | [next] | [standalone]
| From | Doug Miller <doug_at_milmac_dot_com@example.com> |
|---|---|
| Date | 2013-12-15 12:51 +0000 |
| Message-ID | <XnsA2974FDD948C8dougmilmaccom@78.46.70.116> |
| In reply to | #12242 |
Thomas 'PointedEars' Lahn <PointedEars@web.de> wrote in news:2197091.TGfsNCzbWx@PointedEars.de: > [Removed *non-existing* alt.php from the Newsgroups header field value] > > nawfer wrote: > >>>> 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 >> ? > > Once you have learned to write an coherent question, one might be able to > help you. Halt Maul, du Esel. Oh, *do* shut up, PointedHead, you jackass. *Obviously* English is not his first language. And he likely figured that -- given the prevalence of English speakers in the computer language newsgroups -- that he stood a better chance of getting a good answer to a question posed in halting, broken English than one posed in perfect Albanian or whatever his native language is.
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2013-12-15 08:49 -0500 |
| Message-ID | <l8kc0j$2ug$1@dont-email.me> |
| In reply to | #12242 |
On 12/15/2013 6:05 AM, Thomas 'PointedEars' Lahn wrote: > [Removed *non-existing* alt.php from the Newsgroups header field value] > > nawfer wrote: > >>>> 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 >> ? > > Once you have learned to write an coherent question, one might be able to > help you. > His question is quite coherent. > Please also learn to quote. The attribution lines are relevant as a posting > replied to now can and will expire later. > Maybe a little sparse, but he is quoting properly. <snip> >> 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. Why do you want to determine the nation/country? > Now we're starting to get down to the real problem. > > PointedEars > added alt.php back in to the list, since it is appropriate to this discussion. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | Tim Streater <timstreater@greenbee.net> |
|---|---|
| Date | 2013-12-15 13:13 +0000 |
| Message-ID | <151220131313584653%timstreater@greenbee.net> |
| In reply to | #12240 |
In article <10m4kg1lqaghb$.1qos4ncc1tq11$.dlg@40tude.net>, nawfer <novalidsforspam@alt.al> wrote: > >> 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 > > 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. And your organisation might cover a continent or be worldwide. You would use the same IP range for the whole network. -- Tim "That excessive bail ought not to be required, nor excessive fines imposed, nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2013-12-15 08:50 -0500 |
| Message-ID | <l8kc2b$2ug$2@dont-email.me> |
| In reply to | #12240 |
On 12/15/2013 5:34 AM, nawfer wrote: >>> 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 > > 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 addresses do not know national boundaries. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | Arno Welzel <usenet@arnowelzel.de> |
|---|---|
| Date | 2013-12-15 15:22 +0100 |
| Message-ID | <52ADBB35.5080504@arnowelzel.de> |
| In reply to | #12240 |
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: <http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html>
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):
<?php
// This is the list of languages we support
$knownlanguages = { 'en', 'fr', 'it' };
// This is the active language in which the content
// is being served - 'en' by default
$activelanguage = 'en';
// Build an array of languages based on the Accept-Language
// header the browser sends
$languages = explode(',', preg_replace('/(;q=\d+.\d+)/i',
'', getenv('HTTP_ACCEPT_LANGUAGE')));
// Now go through the list and check if the browser
// supports any of "our" languages
foreach ($languages as $language) {
if (in_array($language, $knownlanguages)) {
// Language is known, then use this and stop
// checking the remaining entries
$activelanguage = $language;
break;
}
}
// Now $activelanguage contains one of our supported
// languages which is also accepted by the browser
?>
BTW: You can see this in action on my private site
<http://arnowelzel.de>. 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
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2013-12-15 15:35 +0000 |
| Message-ID | <l8ki7l$gvm$2@news.albasani.net> |
| In reply to | #12240 |
On 15/12/13 10:34, nawfer wrote: >>> 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 > > 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)? > every range is assigned to many more than one nation. Blocks down to 256 IP addresses are allocated more or less randomly among countries. And that's before you consider mobile devices...proxies...and NAT -- Ineptocracy (in-ep-toc’-ra-cy) – a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.
[toc] | [prev] | [next] | [standalone]
| From | Evan Platt <evan@theobvious.espphotography.com.invalid> |
|---|---|
| Date | 2013-12-14 21:35 -0800 |
| Message-ID | <rrfqa950q1haecg5avlkv9ntpdmsj8kd4n@4ax.com> |
| In reply to | #12235 |
On Sat, 14 Dec 2013 18:56:43 -0500, richard <noreply@example.com> wrote: >GeoIP. >This utility reporsts the country based on user's location. >But why not let the user select the proper page wotj a dropdown list? That's funny, you always say you can't determine a users location by their IP. So which is it? -- To reply via e-mail, remove The Obvious and .invalid from my e-mail address.
[toc] | [prev] | [next] | [standalone]
| From | Doug Miller <doug_at_milmac_dot_com@example.com> |
|---|---|
| Date | 2013-12-15 12:42 +0000 |
| Message-ID | <XnsA2974E69D98F9dougmilmaccom@78.46.70.116> |
| In reply to | #12235 |
richard <noreply@example.com> wrote in news:461fsbu98jld.1vftfxn0dl3dg.dlg@40tude.net: > On Sat, 14 Dec 2013 14:43:34 +0100, nawfer wrote: > >> which code to use for send page >> x >> y >> z >> depending by user's nation? > > GeoIP. > This utility reporsts the country based on user's location. No, it does not. It reports the country based on the *presumed* location of the user's *presumed* IP address -- which is *not* a reliable indicator of the actual location of the user.
[toc] | [prev] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2013-12-15 15:21 +0000 |
| Message-ID | <l8khec$uf5$1@dont-email.me> |
| In reply to | #12235 |
On Sat, 14 Dec 2013 18:56:43 -0500, richard wrote: > On Sat, 14 Dec 2013 14:43:34 +0100, nawfer wrote: >> which code to use for send page x >> y >> z >> depending by user's nation? > GeoIP. > This utility reporsts the country based on user's location. > But why not let the user select the proper page wotj a dropdown list? Select random from worlds ten most internet connected countries is probably almost as accurate as IP based country determination. (may contain some exaggeration) -- Denis McMahon, denismfmcmahon@gmail.com
[toc] | [prev] | [standalone]
Page 2 of 2 — ← Prev page 1 [2]
Back to top | Article view | comp.lang.php
csiph-web