PHP code example of ip2location / ip2location-csv-converter

1. Go to this page and download the library: Download ip2location/ip2location-csv-converter 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/ */

    

ip2location / ip2location-csv-converter example snippets


cp ./vendor/ip2location/ip2location-csv-converter/ip2location-csv-converter.php ./
 bash
php ip2location-csv-converter.php [-range | -cidr] [-replace | -append] INPUT_FILE OUTPUT_FILE

php ip2location-csv-converter.php -range -replace IP2LOCATION-DB1.CSV IP2LOCATION-DB1.NEW.CSV

php ip2location-csv-converter.php -cidr -replace IP2LOCATION-DB1.CSV IP2LOCATION-DB1.NEW.CSV

php ip2location-csv-converter.php -hex -replace IP2LOCATION-DB1.CSV IP2LOCATION-DB1.NEW.CSV

php ip2location-csv-converter.php -cidr -append IP2LOCATION-DB1.CSV IP2LOCATION-DB1.NEW.CSV