Skip to content
This repository was archived by the owner on Apr 23, 2020. It is now read-only.

Using.RU

Ivan Dudarev edited this page Oct 7, 2017 · 3 revisions

Using

language: EN RU

Initialization IP Tool

$iptool = new \Ddrv\Iptool\Iptool('/path/to/iptool.database');

Get information about created database

print_r($iptool->about());
Array
(
    [created] => 1507199627
    [author] => Ivan Dudarev
    [license] => MIT
    [networks] => Array
        (
            [count] => 276148
            [data] => Array
                (
                    [country] => Array
                        (
                            [0] => code
                            [1] => name
                        )
                )
        )
)

Search information about IP Address

print_r($iptool->find('81.32.17.89'));
Array
(
    [network] => Array
        (
            [0] => 81.32.0.0
            [1] => 81.48.0.0
        )
    [data] => Array
        (
            [country] => Array
                (
                    [code] => es
                    [name] => Spain
                )
        )
)

Get all items in register

print_r($iptool->getRegister('country'));
Array
(
    [1] => Array
        (
            [code] => cn
            [name] => China
        )
    [2] => Array
        (
            [code] => es
            [name] => Spain
        )
...
    [N] => Array
        (
            [code] => jp
            [name] => Japan
        )
)

Get register item

print_r($iptool->getRegister('country',2));
Array
    (
        [code] => cn
        [name] => China
    )
)
Clone this wiki locally