Usage Instruction for package GeoCoding Ip addresses.
-
For using this package you have to register in the IpInfoDb site and get your free API Key for geocoding IP addresses..
URL for registering: https://www.ipinfodb.com/register
-
Include class on top using following line.
use track_ip\Demo\Demo;
- In composer.json include following line
"require": { "track_ip/Demo": "dev-master" }
- Execute the command
composer update
- Add following line to providers array in app.php
track_ip\Demo\DemoServiceProvider::class
- Add following line to aliases array
'track_ip' => track_ip\Demo\Demo::class
- Use following code in your controller
$ip = $_SERVER['REMOTE_ADDR']; $geo = new Demo(); $format = "json"; // can be raw, xml or json $geovalues = $geo->getGeoLocation($ip, "YOUR IPINFODB API KEY", $format);
- Results
statusCode: 100 statusMessage: Error: Invalid Number Of Arguments Passed
statusCode: 101 statusMessage: Invalid Result Format Requested
statusCode: 102 statusMessage: Invalid Ip Format
statusCode: OK statusMessage: IP Geocoded Successfully