Download the PHP package ip2location/ip2location-csv-converter without Composer
On this page you can find all versions of the php package ip2location/ip2location-csv-converter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ip2location/ip2location-csv-converter
More information about ip2location/ip2location-csv-converter
Files in ip2location/ip2location-csv-converter
Package ip2location-csv-converter
Short Description This PHP script converts IP2Location CSV database into IP range or CIDR format.
License MIT
Homepage https://www.ip2location.com
Informations about the package ip2location-csv-converter
IP2Location CSV Converter
Note: For a more efficient and faster conversion process, we recommend using the IP2Location Python CSV Converter
This PHP script converts IP2Location CSV data file, that contains the IP address in numeric notation, into dot-decimal notation (such as x.x.x.x) or CIDR notation (x.x.x.x/24). It supports both the IP2Location commercial edition, DB1 to DB24 database and also the free edition, IP2Location LITE database. In addition to this, this converter can also be used to convert any CSV file that contains the IP number (the numeric notation).
You can download the IP2Location CSV file at the below links:
IP2Location Commercial Database
IP2Location LITE Database
Please do not use this script to convert IP2Location BIN data file. It only support the CSV format, not the binary format.
Installation
Please install this script using composer.
After that, please copy the php script into the root directory of composer (the folder contains the composer.json and composer.lock files)
Usage
Parameters
Parameter | Description |
---|---|
-range | IP numbers will be converted into the first IP address and last IP address in the range. |
-cidr | IP numbers will be converted into CIDR format. |
-hex | IP numbers will be converted into hexadecimal format. (auto padding) |
-hex4 | IP numbers will be converted into hexadecimal format. (pad IPv4) |
-hex6 | IP numbers will be converted into hexadecimal format. (pad IPv6) |
-replace | The IP numbers in will be replaced to the selected format. |
-append | The converted format will be appended after the IP numbers field. |
Example:
Sample Input
Convert into range with replace option:
Command:
Output:
Convert into CIDR with replace option:
Command:
Output:
Convert into hexadecimal with replace option:
Command:
Output:
Convert into range with append option:
Command:
Output:
Convert into CIDR with append option:
Command:
Output:
Custom Input File
You can use this converter for a custom input file provided the input is in CSV format, with the first and second field contain the ip from and ip to information in numeric format.