定制 apiip/apiip.net 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

apiip/apiip.net

最新稳定版本:v1.2.0

Composer 安装命令:

composer require apiip/apiip.net

包简介

The official PHP library for apiip.net that allowing customers to automate IP address validation and geolocation lookup in websites, applications and back-office system. Visit our API docs at https://apiip.net/documentation

README 文档

README

apiip.net website status Uptime Robot status Uptime Robot ratio (30 days) GitHub issues GitHub code size in bytes GitHub top language

This is the official PHP client library for the apiip.net IP address geolocation API, allowing you to lookup your own IP address, or get any of the details for an IP.

Find geolocation data from IP addresses (e.g. city, country, lat/long) using the apiip.net API.

apiip.net provides 1.000 free requests per month. For higher plans, check out the website

Installation

You need to get your API key from here: https://apiip.net/get-started and you'll get 1.000 free requests/month

Install the package with:

composer require apiip/apiip.net

Usage

The package needs to be configured with your account's API key, which is available in the apiip.net Dashboard

use ApiipClient\Apiip;

$access_key = 'YOUR_ACCESS_KEY';
$client = new Apiip($access_key);
$details = $client->getLocation();

$details['city'];
Belgrade

HTTPS Encryption

By default, the SSL/TLS is turned on, if you want to disable it just pass the options parameter

Example

use ApiipClient\Apiip;

$access_key = 'YOUR_ACCESS_KEY';
$client = new Apiip($access_key, ['ssl' => false]);

Configuration

Call getLocation method with config object

use ApiipClient\Apiip;

$access_key = 'YOUR_ACCESS_KEY';
$client = new Apiip($access_key);
$details = $client->getLocation([
  'ip' => $ip_address, // 67.250.186.196, 188.79.34.191, 60.138.7.24 - for bulk request
  'output' => 'xml',
  'fields' => 'city,country',
  'languages' => 'es'
]);
Option Type Description Default
ip string Optional. Get location about the specify IP or multiple IPs. Requester IP
output string Optional. Specify response format, XML or JSON. JSON
fields string Optional. Specify response fields. All fields
languages string Optional. Specify response language. EN

Example complete response

{
  "ip": "67.250.186.196",
  "continentCode": "NA",
  "continentName": "North America",
  "countryCode": "US",
  "countryName": "United States",
  "countryNameNative": "United States",
  "city": "New York",
  "postalCode": "10001",
  "latitude": 40.8271,
  "longitude": -73.9359,
  "capital": "Washington D.C.",
  "phoneCode": "1",
  "countryFlagEmoj": "🇺🇸",
  "countryFlagEmojUnicode": "U+1F1FA U+1F1F8",
  "isEu": false,
  "borders": [
    "CAN",
    "MEX"
  ],
  "topLevelDomains": [
    ".us"
  ],
  "languages": {
    "en": {
      "code": "en",
      "name": "English",
      "native": "English"
    }
  },
  "currency": {
    "code": "USD",
    "name": "US Dollar",
    "symbol": "$",
    "number": "840",
    "rates": {
      "EURUSD": 1.11
    }
  },
  "timeZone": {
    "id": "America/New_York",
    "currentTime": "10/26/2021, 2:54:10 PM",
    "code": "EDT",
    "timeZoneName": "EDT",
    "utcOffset": -14400
  },
  "userAgent": {
    "isMobile": false,
    "isiPod": false,
    "isTablet": false,
    "isDesktop": true,
    "isSmartTV": false,
    "isRaspberry": false,
    "isBot": false,
    "browser": "Chrome",
    "browserVersion": "100.0.4896.127",
    "operatingSystem": "Windows 10.0",
    "platform": "Microsoft Windows",
    "source": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36"
  },
  "connection": {
    "asn": 12271,
    "isp": "Charter Communications Inc"
  },
  "security": {
    "isProxy": false,
    "isBogon": false,
    "isTorExitNode": false,
    "isCloud": false,
    "isHosting": false,
    "isSpamhaus": false,
    "suggestion": "allow",
    "network": "67.250.176.0/20"
  }
}

More Information

统计信息

  • 总下载量: 11.81k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2022-02-23