From 593505fd8b723c9e031cb59f2703eea9f451895f Mon Sep 17 00:00:00 2001 From: IP2Location Date: Mon, 24 May 2021 11:06:52 +0800 Subject: [PATCH] Added supports for address type and category fields. Also added exception handling for incorrect BIN database. --- README.md | 8 +- data/IP2LOCATION-LITE-DB1.IPV6.BIN | Bin 5253688 -> 5391050 bytes examples/example.php | 8 +- src/Database.php | 714 ++++++++++++++++++----------- 4 files changed, 459 insertions(+), 271 deletions(-) diff --git a/README.md b/README.md index e9a30c9..94b6506 100644 --- a/README.md +++ b/README.md @@ -50,10 +50,10 @@ Below is the description of the functions available in the **Database** class. |---|---| |Constructor|Expect 2 input parameters:
  1. Full path of IP2Location BIN data file.
  2. File Open Mode
    • SHARED_MEMORY
    • MEMORY_CACHE
    • FILE_IO
For SHARED_MEMORY and MEMORY_CACHE, it will require your server to have sufficient memory to hold the BIN data, otherwise it will raise the errors during the object initialization.| |**string** getDate()|Return the database's compilation date as a string of the form 'YYYY-MM-DD'| -|**string** getType()|Return the database's type, 1 to 24 respectively for DB1 to DB24. Please visit https://www.ip2location.com/databases for details.| +|**string** getType()|Return the database's type, 1 to 25 respectively for DB1 to DB25. Please visit https://www.ip2location.com/databases for details.| |**string** getModuleVersion()|Return the version of module| |**string** getDatabaseVersion()|Return the version of database| -|**array** lookup($ip)|Return the IP information in array. Below is the information returned:You can visit [IP2Location](https://www.ip2location.com/databases/db24-ip-country-region-city-latitude-longitude-zipcode-timezone-isp-domain-netspeed-areacode-weather-mobile-elevation-usagetype) for the description of each field. Note: although the above names are not exactly matched with the names given in this link, but they are self-described.| +|**array** lookup($ip)|Return the IP information in array. Below is the information returned:You can visit [IP2Location](https://www.ip2location.com/databases/db25-ip-country-region-city-latitude-longitude-zipcode-timezone-isp-domain-netspeed-areacode-weather-mobile-elevation-usagetype-addresstype-category) for the description of each field. Note: although the above names are not exactly matched with the names given in this link, but they are self-described.| |**array** getCidr($ip)|Return an array of the complete IP list in CIDR format of the detected row record based on the given IP address.| @@ -62,8 +62,8 @@ Below is the description of the functions available in the **WebService** class. | Function Name | Description | | --------------------- | ------------------------------------------------------------ | -| Constructor | Expect 3 input parameters:
  1. IP2Location API Key.
  2. Package (WS1 - WS24)
  3. Use HTTPS or HTTP
| -| **array** lookup($ip) | Return the IP information in array.