IpGeoBase API Client
, (*1)
Description
This library for PHP 5 provides you with convenient object-oriented access
to IPGeoBase XML API., (*2)
IpGeoBase is a free service that allows you to resolve Russian and Ukrainian
IP adresses into geographical locations with the maximum precision of a city.
Database has a daily updates., (*3)
Features
Installation
Install library with Composer:, (*4)
composer require betsol/ipgeobase-client
, (*5)
Usage
// Creating a client:
$ipGeoBaseClient = new Betsol\IpGeoBase\Api\Client;
// You can pass API's base URL to it if required:
$ipGeoBaseClient = new Betsol\IpGeoBase\Api\Client('http://ipgeobase.ru:7020');
// Looking up IP address:
$response = $ipGeoBaseClient->lookupIp('93.184.216.119');
// Getting country:
$response->getCountry();
// "RU"
// Getting city:
$response->getCity();
// "Москва"
// Getting region:
$response->getRegion();
// "Москва"
// Getting district:
$response->getDistrict();
// "Центральный федеральный округ"
// Accessing IP range:
$ipRange = $response->getIpRange();
$ipRange->getStartIp();
// "213.180.200.192"
$ipRange->getEndIp();
// "213.180.208.255"
// Returning IP range as a string:
(string) $ipRange;
// "213.180.200.192 - 213.180.208.255"
// Accessing coordinates:
$coordinates = $response->getCoordinates()
$coordinates->getLatitude();
// float(55.755787)
$coordinates->getLongitude();
// float(37.617634)
// Returning coordinates as a string:
(string) $coordinates;
// string(20) "55.755787, 37.617634"
Feedback
If you have found a bug or have another issue with the library - please create an issue
in this GitHub repository., (*6)
If you have a question - file it with StackOverflow and send me a
link to s.fomin@betsol.ru. I will be glad to help., (*7)
Have any ideas or propositions? Feel free to contact me by E-Mail., (*8)
Cheers!, (*9)
This library is sponsored by Winners Academy., (*10)
License
The MIT License (MIT), (*11)
Copyright (c) 2014 Slava Fomin II, (*12)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:, (*13)
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software., (*14)
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE., (*15)