help on function to know user location

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mscardenas
Forum Newbie
Posts: 5
Joined: Wed May 30, 2007 1:18 am

help on function to know user location

Post by mscardenas »

Hi all!
Is there a php function that returns the location of the user (e.g. return the state/country of a user)?

Thanks.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: help on function to know user location

Post by califdon »

mscardenas wrote:Hi all!
Is there a php function that returns the location of the user (e.g. return the state/country of a user)?

Thanks.
No, because that's not directly determinable. However, geographic locations of IP addresses can be estimated and there is at least one organization that maintains a database of such estimates: http://www.geobytes.com/FreeServices.htm

I use their services at two of my domains: http://poatree.org and http://usselectra.org.
yanglei1979
Forum Commoner
Posts: 38
Joined: Sat Aug 25, 2007 10:21 pm

Re: help on function to know user location

Post by yanglei1979 »

no this function.

but can return IP.
User avatar
jimthunderbird
Forum Contributor
Posts: 147
Joined: Tue Jul 04, 2006 3:59 am
Location: San Francisco, CA

Re: help on function to know user location

Post by jimthunderbird »

You can get the user's ip but since you don't have the ip location mapping database, you can't directly do it.
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Re: help on function to know user location

Post by Kieran Huggins »

http://www.hostip.info has an API - maybe that would work?
Post Reply