Jump to content

Recommended Posts

hello - I am trying to find a solution where we can show content based on the user's physical location.  For example, if we had a gardening website and someone visited the site from California we should show them plants that reside in California.

 

I am not a PHP guy but instead I am on a fact finding mission that I will forward on to our dev team.

 

Thanks in advance!

Okay, to find where a visitor is, its probably best use an IP lookup, eash ISP buy a range of IP address and register them under their name, this includes country, town and city.

 

to get the visitors IP address just use

$_SERVER['REMOTE_HOST']

 

to find the details about that IP, you can use ip2location this is a paid for service, so their will be a cost, their are some free ones (google for IP to city database, or something like that)

 

as a note, you may want to allow the uses to also select their location as a manual override, as the lookup will not always be 100% correct

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.