Download the PHP package tim168/ip without Composer
On this page you can find all versions of the php package tim168/ip. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package ip
Ip
根据IpV4、IpV6地址获取定位信息的PHP组件
安装
使用
require __DIR__ .'/vendor/autoload.php';
use Tim168\Ip\Ip;
支持的语言格式
字符集 | 描述 |
---|---|
en | 英语 |
de | 德语 |
es | 西班牙语 |
pt-BR | 葡语 |
fr | 法语 |
ja | 日语 |
zh-CN | 中文 |
ru | 俄语 |
获取Ip定位信息
$res = Ip::getIp('json','116.234.222.36')
示例
{
"status": "success", //状态success或fail
"country": "中国", //国家
"countryCode": "CN", //国家代码
"region": "SH", //省份简称
"regionName": "上海",//省份
"city": "上海", //城市
"zip": "", //邮编
"lat": 31.0449, //纬度
"lon": 121.4012, //经度
"timezone": "Asia/Shanghai", //时区
"isp": "China Telecom (Group)", //运营商
"org": "Chinanet SH", //组织
"as": "AS4812 China Telecom (Group)", //BGP机房
"query": "116.234.222.36" //ip
}
获取XML格式
$res = Ip::getIp('xml','116.234.222.36')
示例
<?xml version="1.0" encoding="UTF-8"?>
<query>
<status>success</status>
<country>中国</country>
<countryCode>CN</countryCode>
<region>SH</region>
<regionName>上海</regionName>
<city>上海</city>
<zip></zip>
<lat>31.0449</lat>
<lon>121.4012</lon>
<timezone>Asia/Shanghai</timezone>
<isp>China Telecom (Group)</isp>
<org>Chinanet SH</org>
<as>AS4812 China Telecom (Group)</as>
<query>116.234.222.36</query>
</query>
获取CSV格式
$res = Ip::getIp('csv','116.234.222.36')
示例
success,中国,CN,SH,上海,上海,,31.0449,121.4012,Asia/Shanghai,China Telecom (Group),Chinanet SH,AS4812 China Telecom
(Group),116.234.222.36
获取序列化格式
$res = Ip::getIp('php','116.234.222.36')
示例
a:14:{s:6:"status";s:7:"success";s:7:"country";s:6:"中国";s:11:"countryCode";s:2:"CN";s:6:"region";s:2:"SH";s:10:"regionName";s:6:"上海";s:4:"city";s:6:"上海";s:3:"zip";s:0:"";s:3:"lat";d:31.0449;s:3:"lon";d:121.4012;s:8:"timezone";s:13:"Asia/Shanghai";s:3:"isp";s:21:"China
Telecom (Group)";s:3:"org";s:11:"Chinanet SH";s:2:"as";s:28:"AS4812 China Telecom
(Group)";s:5:"query";s:14:"116.234.222.36";}
IpV4转换成IpV6
$res = Ip::IpV4toV6('116.234.222.36')
示例
0000:0000:0000:0000:0000:ffff:74ea:de24
IpV6转换成IpV4
$res = Ip::IpV6toV4('0000:0000:0000:0000:0000:ffff:74ea:de24')
示例
116.234.222.36
License
MIT
后语
欢迎Star
All versions of ip with dependencies
PHP Build Version
Package Version
Requires
php Version
>=5.6
guzzlehttp/guzzle Version ^6.5
phpunit/phpunit Version ~5
ext-mbstring Version *
guzzlehttp/guzzle Version ^6.5
phpunit/phpunit Version ~5
ext-mbstring Version *
The package tim168/ip contains the following files
Loading the files please wait ....