PHP code example of larryli / ipv4

1. Go to this page and download the library: Download larryli/ipv4 library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

larryli / ipv4 example snippets


$monipdb = new \larryli\ipv4\MonipdbQuery(__DIR__ . '/17monipdb.dat');
if (!$monipdb->exists()) {
    $monipdb->init();
}
$qqwry = new \larryli\ipv4\QqwryQuery(__DIR__ . '/qqwry.dat');
if (!$qqwry->exists()) {
    $qqwry->init();
}
$your_query = new \larryli\ipv4\FullQuery(new YourDatabase());
if (!$your_query->exists()) {
    $your_query->setProviders([$monipdb, $qqwry]);
    $your_query->init();
}
$your_query->find(ip2long('127.0.0.1'));

class YourDatabase extends \larryli\ipv4\Database
{
    ...
}