US, Canada or International [message #170244] |
Fri, 22 October 2010 16:42 |
Jeff Thies
Messages: 3 Registered: October 2010
Karma: 0
|
Junior Member |
|
|
I'd like to sniff out whether a visitor is in the US, Canada or
elsewhere. I realize this can't be absolutely reliable but what might be
the best option using php of course.
That, I suppose, could either hash through the user agent or the
remote address. Something else?
Suggestions or code?
Jeff
|
|
|
|
Re: US, Canada or International [message #170264 is a reply to message #170245] |
Sat, 23 October 2010 14:14 |
Daniel Peraza
Messages: 6 Registered: September 2010
Karma: 0
|
Junior Member |
|
|
There are a bunch of several web services and APIS that will allow you
to geocode the visitor's IP address.For instance, try maxmind's geoip
or yahoo geo coding services (the latter being recommended). Google
them out and you'll see what I mean.
On Oct 22, 1:23 pm, Denis McMahon <denis.m.f.mcma...@googlemail.com>
wrote:
> On 22/10/10 17:42, Jeff Thies wrote:
>
>> I'd like to sniff out whether a visitor is in the US, Canada or
>> elsewhere. I realize this can't be absolutely reliable but what might be
>> the best option using php of course.
>
>> That, I suppose, could either hash through the user agent or the
>> remote address. Something else?
>
>> Suggestions or code?
>
> whois the ip address?
>
> Have a look athttp://www.geobytes.com/iplocator.htm
>
> Maybe start with:
>
> <?php
>
> $url =
> ' http://www.geobytes.com/IpLocator.htm?GetLocation&template=php3.txt& ;I....
> . $_SERVER['REMOTE_ADDR'];
> $tags = get_meta_tags($url);
>
> echo "<pre>\n";
> print_r ($tags);
> echo "</pr
e>\n";
>
> ?>
>
> Rgds
>
> Denis McMahon
|
|
|