All Projects → ip2location → ip2location-lua

ip2location / ip2location-lua

Licence: MIT license
Use IP2Location geolocation database to lookup the geolocation information with IP2Location Lua Package. It can be used to determine country, region, city, coordinates, zip code, time zone, ISP, domain name, connection type, area code, weather, MCC, MNC, mobile brand name, elevation, usage type, address type and IAB category that any IP address …

Programming Languages

lua
6591 projects

Projects that are alternatives of or similar to ip2location-lua

ip2location-csv-converter
This PHP script converts IP2Location CSV database into IP range or CIDR format.
Stars: ✭ 26 (+85.71%)
Mutual labels:  geolocation, ip-geolocation, ip2location
ip2location-cakephp
IP2Location CakePHP plugin enables the user to find the country, region, city, coordinates, zip code, time zone, ISP, domain name, connection type, area code, weather, MCC, MNC, mobile brand name, elevation, usage type, IP address type and IAB advertising category from IP address using IP2Location database.
Stars: ✭ 17 (+21.43%)
Mutual labels:  geolocation, ip-geolocation, ip2location
ip2location-iata-icao
This list contains the airport codes of IATA airport code and ICAO airport code together with country code and region name supported in IP2Location geolocation database.
Stars: ✭ 39 (+178.57%)
Mutual labels:  geolocation, ip-geolocation, ip2location
ip2location-nginx
This is IP2Location Nginx module that enables the user to find the country, region (state), city, latitude, longitude, zip code, time zone, ISP, domain name, connection type, area code, weather, mobile network, elevation, usage type, address type and IAB category by IP address or hostname originates from.
Stars: ✭ 38 (+171.43%)
Mutual labels:  geolocation, ip-geolocation, ip2location
ip2location-piwik
Use IP2Location geolocation database to lookup for accurate visitor location in Matomo (Piwik) 3.x. It enables the user to find the country, region, city, coordinates, zip code, time zone, ISP, domain name, connection type, area code, weather, MCC, MNC, mobile brand name, elevation, usage type, address type and IAB category that any IP address o…
Stars: ✭ 26 (+85.71%)
Mutual labels:  geolocation, ip-geolocation, ip2location
IP2Country
Ip to country mapping
Stars: ✭ 39 (+178.57%)
Mutual labels:  geolocation, ip-geolocation, ip2location
WordPress-IP-Geo-Block
A WordPress plugin that will blocks any comment, pingback and trackback spams posted from outside your nation. And it will also protect against malicious access to the login form, admin area and XML-RPC from undesired countries.
Stars: ✭ 26 (+85.71%)
Mutual labels:  ip-geolocation, ip2location
geolocation
A laravel integration for using the IPInfoDB and Ip2Location services
Stars: ✭ 38 (+171.43%)
Mutual labels:  geolocation, ip2location
ip2location-nginx
Nginx module that allows user to lookup for geolocation information using IP2Location database.
Stars: ✭ 33 (+135.71%)
Mutual labels:  geolocation, ip2location
IP2Location-C-Library
IP2Location C library enables the user to find the country, region, city, coordinates, zip code, time zone, ISP, domain name, connection type, area code, weather station code, weather station name, mobile, usage types, etc that any IP address or hostname originates from.
Stars: ✭ 37 (+164.29%)
Mutual labels:  geolocation, ip2location
ipapi-python
Python bindings for https://ipapi.co (IP Address Location) - Use with python / django / flask for IP address location lookup
Stars: ✭ 42 (+200%)
Mutual labels:  geolocation, ip-geolocation
ip-location-db
ip to location database by ASN, GeoFeed, Whois, iptoasn.com, db-ip lite, GeoLite2
Stars: ✭ 160 (+1042.86%)
Mutual labels:  ip-geolocation, ip2location
Geolocate-IP-Browser-Extension
A browser extension, which shows you the origin of your IP address.
Stars: ✭ 21 (+50%)
Mutual labels:  geolocation, ip-geolocation
ipinfodb-php
PHP library to query free IPInfoDB API service.
Stars: ✭ 15 (+7.14%)
Mutual labels:  geolocation, ip2location
IP2Location-PHP-Module
This module is a PHP module that enables the user to find the country, region, city, coordinates, zip code, ISP, domain name, timezone, connection speed, IDD code, area code, weather station code, weather station name, mobile, usage types, address type, IAB category, etc that any IP address or host name originates from.
Stars: ✭ 154 (+1000%)
Mutual labels:  geolocation, ip2location
mmdb-server
mmdb-server is an open source fast API server to lookup IP addresses for their geographic location.
Stars: ✭ 69 (+392.86%)
Mutual labels:  geolocation, ip-geolocation
GoGoCarto
This repo has been moved to https://gitlab.adullact.net/pixelhumain/GoGoCarto since 17/12/2018
Stars: ✭ 43 (+207.14%)
Mutual labels:  geolocation
ip2proxy-go
IP2Proxy Go package allows users to query an IP address to determine if it was being used as open proxy, web proxy, VPN anonymizer and TOR exits.
Stars: ✭ 12 (-14.29%)
Mutual labels:  ip2location
google-maps-places-geolocation-for-your-ionic-app
Ionic example app of how to add Google maps, places, geolocation and related features into an Ionic Framework app.
Stars: ✭ 13 (-7.14%)
Mutual labels:  geolocation
emapic
Open source repository with the source code of the geolocated surveys engine Emapic, developed by the laboratory CartoLAB of the Universidade da Coruña.
Stars: ✭ 14 (+0%)
Mutual labels:  geolocation

IP2Location Lua Package

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.

This package can be used in many types of projects such as:

  • select the geographically closest mirror
  • analyze your web server logs to determine the countries of your visitors
  • credit card fraud detection
  • software export controls
  • display native language and currency
  • prevent password sharing and abuse of service
  • geotargeting in advertisement

The database will be updated in monthly basis for the greater accuracy. Free LITE databases are available at https://lite.ip2location.com/ upon registration.

The paid databases are available at https://www.ip2location.com under Premium subscription package.

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:

https://www.ip2location.com/web-service/ip2location

Installation

luarocks install ip2location

QUERY USING THE BIN FILE

Dependencies

This package requires IP2Location BIN data file to function. You may download the BIN data file at

IPv4 BIN vs IPv6 BIN

Use the IPv4 BIN file if you just need to query IPv4 addresses.

Use the IPv6 BIN file if you need to query BOTH IPv4 and IPv6 addresses.

Methods

Below are the methods supported in this package.

Method Name Description
get_all Returns the geolocation information in an object.
get_country_short Returns the country code.
get_country_long Returns the country name.
get_region Returns the region name.
get_city Returns the city name.
get_isp Returns the ISP name.
get_latitude Returns the latitude.
get_longitude Returns the longitude.
get_domain Returns the domain name.
get_zipcode Returns the ZIP code.
get_timezone Returns the time zone.
get_netspeed Returns the net speed.
get_iddcode Returns the IDD code.
get_areacode Returns the area code.
get_weatherstationcode Returns the weather station code.
get_weatherstationname Returns the weather station name.
get_mcc Returns the mobile country code.
get_mnc Returns the mobile network code.
get_mobilebrand Returns the mobile brand.
get_elevation Returns the elevation in meters.
get_usagetype Returns the usage type.
get_addresstype Returns the address type.
get_category Returns the IAB category.
close Closes BIN file and resets metadata.

Usage

ip2location = require('ip2location')

local ip2loc = ip2location:new('IP-COUNTRY-REGION-CITY-LATITUDE-LONGITUDE-ZIPCODE-TIMEZONE-ISP-DOMAIN-NETSPEED-AREACODE-WEATHER-MOBILE-ELEVATION-USAGETYPE-ADDRESSTYPE-CATEGORY.BIN')

local result = ip2loc:get_all('8.8.8.8')

print("country_short: " .. result.country_short)
print("country_long: " .. result.country_long)
print("region: " .. result.region)
print("city: " .. result.city)
print("isp: " .. result.isp)
print("latitude: " .. result.latitude)
print("longitude: " .. result.longitude)
print("domain: " .. result.domain)
print("zipcode: " .. result.zipcode)
print("timezone: " .. result.timezone)
print("netspeed: " .. result.netspeed)
print("iddcode: " .. result.iddcode)
print("areacode: " .. result.areacode)
print("weatherstationcode: " .. result.weatherstationcode)
print("weatherstationname: " .. result.weatherstationname)
print("mcc: " .. result.mcc)
print("mnc: " .. result.mnc)
print("mobilebrand: " .. result.mobilebrand)
print("elevation: " .. result.elevation)
print("usagetype: " .. result.usagetype)
print("addresstype: " .. result.addresstype)
print("category: " .. result.category)

ip2loc:close()

QUERY USING THE IP2LOCATION WEB SERVICE

Methods

Below are the methods supported in this package.

Method Name Description
open 3 input parameters:
  1. IP2Location API Key.
  2. Package (WS1 - WS25)
  3. Use HTTPS or HTTP
lookup Query IP address. This method returns an object containing the geolocation info.
  • country_code
  • country_name
  • region_name
  • city_name
  • latitude
  • longitude
  • zip_code
  • time_zone
  • isp
  • domain
  • net_speed
  • idd_code
  • area_code
  • weather_station_code
  • weather_station_name
  • mcc
  • mnc
  • mobile_brand
  • elevation
  • usage_type
  • address_type
  • category
  • continent
    • name
    • code
    • hemisphere
    • translations
  • country
    • name
    • alpha3_code
    • numeric_code
    • demonym
    • flag
    • capital
    • total_area
    • population
    • currency
      • code
      • name
      • symbol
    • language
      • code
      • name
    • idd_code
    • tld
    • is_eu
    • translations
  • region
    • name
    • code
    • translations
  • city
    • name
    • translations
  • geotargeting
    • metro
  • country_groupings
  • time_zone_info
    • olson
    • current_time
    • gmt_offset
    • is_dst
    • sunrise
    • sunset
    get_credit This method returns the web service credit balance in an object.

    Usage

    ip2locationwebservice = require('ip2locationwebservice')
    
     local apikey = 'YOUR_API_KEY'
    local apipackage = 'WS25'
    local usessl = true
    local lang = 'fr' -- leave blank if no need
    local addon = 'continent,country,region,city,geotargeting,country_groupings,time_zone_info' -- leave blank if no need
    
    local ip = '8.8.8.8'
    local ws = ip2locationwebservice:open(apikey, apipackage, usessl)
    
    local result = ws:lookup(ip, addon, lang)
    
    if result["response"] == nil then
      print("Error: Unknown error.")
    elseif result.response == "OK" then
      -- standard results
      print("response: " .. result.response)
      print("country_code: " .. result.country_code)
      print("country_name: " .. result.country_name)
      print("region_name: " .. result.region_name)
      print("city_name: " .. result.city_name)
      print("latitude: " .. result.latitude)
      print("longitude: " .. result.longitude)
      print("zip_code: " .. result.zip_code)
      print("time_zone: " .. result.time_zone)
      print("isp: " .. result.isp)
      print("domain: " .. result.domain)
      print("net_speed: " .. result.net_speed)
      print("idd_code: " .. result.idd_code)
      print("area_code: " .. result.area_code)
      print("weather_station_code: " .. result.weather_station_code)
      print("weather_station_name: " .. result.weather_station_name)
      print("mcc: " .. result.mcc)
      print("mnc: " .. result.mnc)
      print("mobile_brand: " .. result.mobile_brand)
      print("elevation: " .. result.elevation)
      print("usage_type: " .. result.usage_type)
      print("address_type: " .. result.address_type)
      print("category: " .. result.category)
      print("category_name: " .. result.category_name)
      print("credits_consumed: " .. result.credits_consumed)
    
      -- continent addon
      if result["continent"] ~= nil then
        print("continent => name: " .. result.continent.name)
        print("continent => code: " .. result.continent.code)
        print("continent => hemisphere: " .. table.concat(result.continent.hemisphere,","))
        if lang ~= '' and result.continent.translations[lang] ~= nil then
          print("continent => translations => " .. lang .. ": " .. result.continent.translations[lang])
        end
      end
    
      -- country addon
      if result["country"] ~= nil then
        print("country => name: " .. result.country.name)
        print("country => alpha3_code: " .. result.country.alpha3_code)
        print("country => numeric_code: " .. result.country.numeric_code)
        print("country => demonym: " .. result.country.demonym)
        print("country => flag: " .. result.country.flag)
        print("country => capital: " .. result.country.capital)
        print("country => total_area: " .. result.country.total_area)
        print("country => population: " .. result.country.population)
        print("country => idd_code: " .. result.country.idd_code)
        print("country => tld: " .. result.country.tld)
        print("country => is_eu: " .. tostring(result.country.is_eu))
        if lang ~= '' and result.country.translations[lang] ~= nil then
          print("country => translations => " .. lang .. ": " .. result.country.translations[lang])
        end
    
        print("country => currency => code: " .. result.country.currency.code)
        print("country => currency => name: " .. result.country.currency.name)
        print("country => currency => symbol: " .. result.country.currency.symbol)
    
        print("country => language => code: " .. result.country.language.code)
        print("country => language => name: " .. result.country.language.name)
      end
    
      -- region addon
      if result["region"] ~= nil then
        print("region => name: " .. result.region.name)
        print("region => code: " .. result.region.code)
        if lang ~= '' and result.region.translations[lang] ~= nil then
          print("region => translations => " .. lang .. ": " .. result.region.translations[lang])
        end
      end
    
      -- city addon
      if result["city"] ~= nil then
        print("city => name: " .. result.city.name)
        if lang ~= '' and result.city.translations[lang] ~= nil then
          print("city => translations => " .. lang .. ": " .. result.city.translations[lang])
        end
      end
    
      -- geotargeting addon
      if result["geotargeting"] ~= nil then
        print("geotargeting => metro: " .. result.geotargeting.metro)
      end
    
      -- country_groupings addon
      if result["country_groupings"] ~= nil then
        for i,v in ipairs(result.country_groupings) do
          print("country_groupings => #" .. i .. " => acronym: " .. result.country_groupings[i].acronym)
          print("country_groupings => #" .. i .. " => name: " .. result.country_groupings[i].name)
        end
      end
    
      -- time_zone_info addon
      if result["time_zone_info"] ~= nil then
        print("time_zone_info => olson: " .. result.time_zone_info.olson)
        print("time_zone_info => current_time: " .. result.time_zone_info.current_time)
        print("time_zone_info => gmt_offset: " .. result.time_zone_info.gmt_offset)
        print("time_zone_info => is_dst: " .. result.time_zone_info.is_dst)
        print("time_zone_info => sunrise: " .. result.time_zone_info.sunrise)
        print("time_zone_info => sunset: " .. result.time_zone_info.sunset)
      end
    
      local result2 = ws:get_credit()
      print("Credit Balance: " .. result2.response)
    else
      print("Error: " .. result.response)
    end
    Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].