开发者

IP to location + local time?

开发者 https://www.devze.com 2023-03-01 06:10 出处:网络
Currently I\'ve been using http://www.geoiptool.com/ but I can\'t get the local t开发者_开发技巧ime.I don\'t know what to do to get the local time.

Currently I've been using http://www.geoiptool.com/ but I can't get the local t开发者_开发技巧ime. I don't know what to do to get the local time.

Can someone help me out, to display location + local time? I have a mail app and I try to display IP in location + local time.


Well, this is not real answer to your question but can help you to properly understand how inaccurate this method is.

Please, read this answer as a side note.

Yes, it's OK to offer or set location/time for your users. But you should provide country/time selector for them also. Some of IP's can not be resolved properly (anonymous proxy, borrowed IPs from other countries (my case), continental IPs (like group "Europe", "Asia", etc), etc.

My case shows how this approach may be wrong.

When I've tried ipLocator from geobytes.com I've got this:

IP to location + local time?

My IP address has been resolved to:

  • Location: Romania
  • Time offset: +0200 (at the moment DST is active so it's +0300)

Real problem is that my location is not Romania, and my time offset is +0100/+0200.

Look this picture:

IP to location + local time?

Red arrow shows my real location. Info in black box shows correct values for my real location. Well, wrong location is not such a big problem for users, but wrong local time is very annoying thing.

Yes, I know, that's not what you're looking for. But you should not fix users location and/or local time because it can be wrong approach. IPv4 address is certainly not something accurate to get real info about user.

Also, I found that ipLocator doesn't follow DST rules and using that time offset (image #1) will show wrong local time during Summer (for countries/regions/provinces which consider DST).


Geobytes will give you the offset:

http://www.geobytes.com/IpLocator.htm?GetLocation&IpAddress=64.34.119.12

Or in an XML format (you might need to view source to see it):

http://www.geobytes.com/IpLocator.htm?GetLocation&template=php3.txt&IpAddress=64.34.119.12

This will give you the offset, just add/subtract the offset to GMT/UTC.

0

精彩评论

暂无评论...
验证码 换一张
取 消