0

I would like to show information on my website based on user's geography. In my current design would not want the user to enter their location/zip code. Using IP I can find user's location but how do i leverage this information to show relevant events/information from surrounding cities/town.

Thanks

jsp
  • 2,546
  • 5
  • 36
  • 63
  • What relevant events/information? Need more detail on your requirements... – Dave Swersky Nov 18 '09 at 21:12
  • I assume this is in your privacy policy and terms of use, right? – John Nov 18 '09 at 21:12
  • Remember IP-to-location databases can be way off for some users, and offering to use zip code is not only reasonable, it lets users do what they want. For example, I'm vacationing in Nevada next month, but I'm currently no where close, can I look up events/information for there from your site? –  Nov 18 '09 at 21:16
  • Like Dave said... Where do you plan to get the relevant events/information? Do you already have it in a database? Or are you asking how to find services that will provide you with a list of events if you submit a zip code or street address? – Jeff Nov 18 '09 at 21:21
  • I have list of events based on zipcodes on my website. so lets say the user is in San jose and there is an event in San Francisco. I would like to show the user events from San Francisco in addition to then san jose. something on the lines of ticketmaster.com. – jsp Nov 18 '09 at 21:26

3 Answers3

0

Based on IPs, you only have a certain accuracy with showing location. You should have a option that lets them enter their city/state or zip code.

Once you have long/lat, you just need to run a query to find records in your database a specific distance from that long/lat.

PHP/MySQL: Select locations close to a given location from DB

Community
  • 1
  • 1
gahooa
  • 131,293
  • 12
  • 98
  • 101
0

http://www.ipinfodb.com/ip_location_api.php

this will send you an xml response with the pertinent information

JERiv
  • 554
  • 1
  • 4
  • 8
0

Lets say you can get their City from the IP address. You would need a database of cities with ID's that would pertain to other database entries. Like:

database table cities    database table restaurants
---------------------    --------------------------
ID       City            ID     city_id     name

1        Los Angelos     1      1           Big Al's

Then you could search for restaurants that have the city_id of the city you got from their IP.

There are so many different approaches to relational databases. This is just one small example.

a432511
  • 1,907
  • 4
  • 26
  • 48