danilo9/get_ip

获取IP信息

v1.0 2022-05-30 09:23 UTC

This package is auto-updated.

Last update: 2024-09-22 10:40:36 UTC


README

获取IP信息

可获取的字段

  • 洲代码
  • 国家
  • 国家代码
  • 货币
  • 地区名称
  • 城市
  • 时区
  • 隐私
    • 代理
    • 移动
    • 托管
  • 位置
    • 纬度
    • 经度
  • 邮编
  • 地区
  • ISP
  • AS
  • AS名称

安装

composer require danilo9/get_ip

文档

声明一个类

use Danilo9\GetIp\GetIp;
$getIp = new GetIp();

选项

$getIp = new GetIp(['lang' => 'ru']);

获取IP信息

$info = $getIp->process('176.59.134.100');

默认为 $_SERVER['REMOTE_ADDR']

获取信息

// Returning string
$info->getStatus();
$info->getIp();
$info->getContinent();
$info->getContinentCode();
$info->getCountry();
$info->getCountryCode();
$info->getCurrency();
$info->getRegionName();
$info->getCity();
$info->getTimezone();
$info->getZip();
$info->getRegion();
$info->toJson();
$info->getLocation()->toJson();
$info->getPrivacy()->toJson();
// int
$info->getLocation()->getLat();
$info->getLocation()->getLon();
//bool
$info->getPrivacy()->getMobile();
$info->getPrivacy()->getProxy();
$info->getPrivacy()->getHosting();
// array
$info->toArray();
$info->getLocation()->toArray();
$info->getPrivacy()->toArray();
// jSON
$info->toJson();
$info->getLocation()->toJson();
$info->getPrivacy()->toJson();

许可证

Apache License 2.0