如何通过IP获取时区 [英] How to get timezone by IP

查看:18
本文介绍了如何通过IP获取时区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个注册,通过它我可以获得注册用户的IP地址.

I have a registration by which i can get the IP address of user who registers.

我想通过他的 IP 地址获取用户的时区.

I want to get the timezone of user by his IP address.

就像在 jquery 中我们可以这样jquery 中的时区

Like in jquery we can get like this Timezone in jquery

我如何在 PHP 中做到这一点.

How can i do it in PHP.

推荐答案

您可以使用基于 GeoIP 的服务 http://www.php.net/manual/en/book.geoip.php

You can use GeoIP based services http://www.php.net/manual/en/book.geoip.php

或者

您可以使用提供您在请求中提供的 IP 的时区的在线服务

You can use online services that gives timezone of the IP that you supply in request

$tags = get_meta_tags('http://www.geobytes.com/IpLocator.htm?GetLocation&template=php3.txt&IpAddress=94.55.180.139'); 
echo $tags['timezone'];

这篇关于如何通过IP获取时区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆