You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This Lua package provides a fast lookup of country, region, city, latitude, longitude, ZIP code, time zone, ISP, domain name, connection type, IDD code, area code, weather station code, station name, mcc, mnc, mobile brand, elevation, usage type, address type and IAB category from IP address by using IP2Location database. This package uses a file based database available at IP2Location.com. This database simply contains IP blocks as keys, and other information such as country, region, city, latitude, longitude, ZIP code, time zone, ISP, domain name, connection type, IDD code, area code, weather station code, station name, mcc, mnc, mobile brand, elevation, usage type, address type and IAB category as values. It supports both IP address in IPv4 and IPv6.
5
4
@@ -17,16 +16,64 @@ The database will be updated in monthly basis for the greater accuracy. Free LIT
17
16
18
17
The paid databases are available at https://www.ip2location.com under Premium subscription package.
19
18
19
+
As an alternative, this library can also call the IP2Location Web Service. This requires an API key. If you don't have an existing API key, you can subscribe for one at the below:
This package requires IP2Location BIN data file to function. You may download the BIN data file at
34
+
* IP2Location LITE BIN Data (Free): https://lite.ip2location.com
35
+
* IP2Location Commercial BIN Data (Comprehensive): https://www.ip2location.com
36
+
37
+
38
+
## IPv4 BIN vs IPv6 BIN
39
+
40
+
Use the IPv4 BIN file if you just need to query IPv4 addresses.
41
+
42
+
Use the IPv6 BIN file if you need to query BOTH IPv4 and IPv6 addresses.
43
+
44
+
45
+
## Methods
46
+
47
+
Below are the methods supported in this package.
48
+
49
+
|Method Name|Description|
50
+
|---|---|
51
+
|get_all|Returns the geolocation information in an object.|
52
+
|get_country_short|Returns the country code.|
53
+
|get_country_long|Returns the country name.|
54
+
|get_region|Returns the region name.|
55
+
|get_city|Returns the city name.|
56
+
|get_isp|Returns the ISP name.|
57
+
|get_latitude|Returns the latitude.|
58
+
|get_longitude|Returns the longitude.|
59
+
|get_domain|Returns the domain name.|
60
+
|get_zipcode|Returns the ZIP code.|
61
+
|get_timezone|Returns the time zone.|
62
+
|get_netspeed|Returns the net speed.|
63
+
|get_iddcode|Returns the IDD code.|
64
+
|get_areacode|Returns the area code.|
65
+
|get_weatherstationcode|Returns the weather station code.|
66
+
|get_weatherstationname|Returns the weather station name.|
67
+
|get_mcc|Returns the mobile country code.|
68
+
|get_mnc|Returns the mobile network code.|
69
+
|get_mobilebrand|Returns the mobile brand.|
70
+
|get_elevation|Returns the elevation in meters.|
71
+
|get_usagetype|Returns the usage type.|
72
+
|get_addresstype|Returns the address type.|
73
+
|get_category|Returns the IAB category.|
74
+
|close|Closes BIN file and resets metadata.|
75
+
76
+
## Usage
30
77
31
78
```lua
32
79
ip2location=require('ip2location')
@@ -62,20 +109,141 @@ ip2loc:close()
62
109
63
110
```
64
111
65
-
Dependencies
66
-
============
67
-
68
-
The complete database is available at https://www.ip2location.com under subscription package.
69
-
112
+
## QUERY USING THE IP2LOCATION WEB SERVICE
70
113
71
-
IPv4 BIN vs IPv6 BIN
72
-
====================
114
+
## Methods
115
+
Below are the methods supported in this package.
73
116
74
-
Use the IPv4 BIN file if you just need to query IPv4 addresses.
75
-
Use the IPv6 BIN file if you need to query BOTH IPv4 and IPv6 addresses.
117
+
|Method Name|Description|
118
+
|---|---|
119
+
|open| 3 input parameters:<ol><li>IP2Location API Key.</li><li>Package (WS1 - WS25)</li></li><li>Use HTTPS or HTTP</li></ol> |
120
+
|lookup|Query IP address. This method returns an object containing the geolocation info. <ul><li>country_code</li><li>country_name</li><li>region_name</li><li>city_name</li><li>latitude</li><li>longitude</li><li>zip_code</li><li>time_zone</li><li>isp</li><li>domain</li><li>net_speed</li><li>idd_code</li><li>area_code</li><li>weather_station_code</li><li>weather_station_name</li><li>mcc</li><li>mnc</li><li>mobile_brand</li><li>elevation</li><li>usage_type</li><li>address_type</li><li>category</li><li>continent<ul><li>name</li><li>code</li><li>hemisphere</li><li>translations</li></ul></li><li>country<ul><li>name</li><li>alpha3_code</li><li>numeric_code</li><li>demonym</li><li>flag</li><li>capital</li><li>total_area</li><li>population</li><li>currency<ul><li>code</li><li>name</li><li>symbol</li></ul></li><li>language<ul><li>code</li><li>name</li></ul></li><li>idd_code</li><li>tld</li><li>is_eu</li><li>translations</li></ul></li><li>region<ul><li>name</li><li>code</li><li>translations</li></ul></li><li>city<ul><li>name</li><li>translations</li></ul></li><li>geotargeting<ul><li>metro</li></ul></li><li>country_groupings</li><li>time_zone_info<ul><li>olson</li><li>current_time</li><li>gmt_offset</li><li>is_dst</li><li>sunrise</li><li>sunset</li></ul></li><ul>|
121
+
|get_credit|This method returns the web service credit balance in an object.|
76
122
123
+
## Usage
77
124
78
-
Copyright
79
-
=========
80
-
81
-
Copyright (C) 2021 by IP2Location.com, support@ip2location.com
0 commit comments