0

I'd like to know if it's possible to find someone's sun rise and sun set times based on their IP address.

For example, my if my IP is 192.168.0.9. I'd live in city X and my sun rise time would be Y

IF this is possible, please point me in the correct direction on how to do this.

uneducatedguy
  • 1,331
  • 1
  • 10
  • 27
  • 1
    What's the problem? Finding the location? Converting the location data into a suitable format for your data source? Finding a data source (that's not really a programming problem, BTW)? Something else? – Quentin Apr 15 '13 at 07:58
  • I guess, the question now is how would i get the user's location in a format that would work with php's built in data sunrise and data sunset – uneducatedguy Apr 15 '13 at 08:04
  • 1
    Google GeoIP for a solution to get lat/long from IP address – Mark Baker Apr 15 '13 at 08:13

2 Answers2

4

date_sunrise() and date_sunset: you'll need to use GeoIP (or similar) to get the lat/long from the user's IP

Mark Baker
  • 209,507
  • 32
  • 346
  • 385
0

One approach would be to gather the zip code from the ip address. There are ip to zip code databases on the internet with some that are offered as a service. Search the web for "ip to zip code databases"

Once you determine the zip code from the ip, then you can determine the sunrise and sunset from a site like Sunrise / Sunset Times.

ip2location.com/developers

SoftwareCarpenter
  • 3,835
  • 3
  • 25
  • 37