https://github.com/daandesmedt/ipinfodb-php-wrapper
Basic PHP wrapper for the IPInfoDB Geolocation API
https://github.com/daandesmedt/ipinfodb-php-wrapper
Last synced: 3 months ago
JSON representation
Basic PHP wrapper for the IPInfoDB Geolocation API
- Host: GitHub
- URL: https://github.com/daandesmedt/ipinfodb-php-wrapper
- Owner: DaanDeSmedt
- Created: 2017-03-29T10:23:30.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-29T11:42:03.000Z (about 8 years ago)
- Last Synced: 2025-01-11T18:29:04.259Z (5 months ago)
- Language: PHP
- Homepage: http://ipinfodb.com/
- Size: 5.86 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
IPInfoDB PHP wrapper
=======Basic PHP wrapper for the [IPInfoDB Geolocation API] (http://ipinfodb.com/)
### Installation
Download and include in your project.
Not listed on Composer.### Methods
#### Get city precision GEO location
Use `->getCity($ip)` to retrieve city precision from specified IP address.Return JSON response format:
```
{
"statusCode" : "OK",
"statusMessage" : "",
"ipAddress" : "192.78.226.199",
"countryCode" : "BE",
"countryName" : "Belgium",
"regionName" : "Brussels Hoofdstedelijk Gewest",
"cityName" : "Brussels",
"zipCode" : "1210",
"latitude" : "50.8504",
"longitude" : "4.34878",
"timeZone" : "+01:00"
}
```#### Get country precision GEO information
Use `->getCountry($ip)` to retrieve country precision from specified IP address.
Faster then the `->getCity($ip)` method, due to decrease of accuracy.Example json response:
```
{
"statusCode" : "OK",
"statusMessage" : "",
"ipAddress" : "192.78.226.199",
"countryCode" : "BE",
"countryName" : "Belgium",
}
```### API keys & query limits
You can get a (free) API key [here](http://ipinfodb.com/register.php), obviously this should be kept private.
While there are no strict query limits if you send more than 2 requests per second they will be queued.```php
// Create a new instance
$ipInfo = new IpInfoDB(APIKEY, 'format');
$location = json_decode($ipInfo->getCity('ip'));
$location = json_decode($ipInfo->getCountry('ip'));
var_dump($location);
```#### Formats
`raw`
`xml`
`json`