Re: ip to country
| From: | Tom Reed | Date: | Sun, 21 Mar 2004 02:27:57 +0000 |
| Subject: | Re: ip to country | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-181064@lists.php.net to get a copy of this message | ||
I would think using HTTP_ACCEPT_LANGUAGE to get the users browser
language/country info would be quicker and easier to implement.
Example:
$string = getenv('HTTP_ACCEPT_LANGUAGE');
list($language, $country) = split('[-,]', $string);
-Tom Reed
centrex@unifiedent.com
"Enda Nagle" <lists@nightsol.net> wrote in message
news:GMEJLLEHPDHJEDGFHBIHEEBGEJAA.lists@nightsol.net...
> I have a site that will have different pricing by world region / country
and
> also offer different currencies.
>
> Presently, the user has to select their country from a select menu and
> submit the form, but I would like to eliminate this step if possible, and
> set the country according to their IP address.
>
> I had a quick look at http://www.iptocountry.com but was
> wondering if
there
> was a way of doing this with PHP functions?
>
> I know its in use on the php.net and google.com sites (when I go to either
I
> get ie.php.net or google.ie) so was wondering if its costly / easy to
> implement?
>
> Thanks for the help,
>
> Enda
> --
>
>
> Enda Nagle
> +353 86 168 0774
> enda@nightsol.net
> www.nightsol.net