FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » US, Canada or International
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
US, Canada or International [message #170244] Fri, 22 October 2010 16:42 Go to next message
Jeff Thies is currently offline  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 #170245 is a reply to message #170244] Fri, 22 October 2010 17:23 Go to previous messageGo to next message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma: 0
Senior Member
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 at http://www.geobytes.com/iplocator.htm

Maybe start with:

<?php

$url =
' http://www.geobytes.com/IpLocator.htm?GetLocation&template=php3.txt& ;IpAddress='
.. $_SERVER['REMOTE_ADDR'];
$tags = get_meta_tags($url);

echo "<pre>\n";
print_r ($tags);
echo "</pre>\n";

?>

Rgds

Denis McMahon
Re: US, Canada or International [message #170264 is a reply to message #170245] Sat, 23 October 2010 14:14 Go to previous message
Daniel Peraza is currently offline  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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Displaying a longblob as an image
Next Topic: DOMDocument loadHTML and double UTF8 encode
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Sep 20 19:38:14 GMT 2024

Total time taken to generate the page: 0.02591 seconds