This isn’t specifically a PHP question but since that’s what our app is using, I thought I’d start here. The application we’re developing requires time stamps on certain things and they need to be based on the user’s actual time. Obviously we can collect time zone info when they register but are there some behind the scenes way to get the information from the zip code they give us? Preferably something free.
PECL Extension: GEOIP
Were it me, i’d use a database (GeoNames puts out a TSV file for the US: http://www.geonames.org/export/zip/US.zip ) to translate Zip to State, and then map State to time zone ([FPHP]geoip_time_zone_by_country_and_region[/FPHP])
Thanks for the tips.
Wouldn’t this have to assume that the user has their clock set correctly?
and that the user never went on a business trip or vacation…
This is why you use geoIp to get their starting location (if you want) but allow them to enter their own zip if they see that it is incorrect, you can still use geoIp to obtain info based on that rather than IP