Skip to content
This repository has been archived by the owner on Mar 24, 2021. It is now read-only.
/ ip2location-java Public archive

This Java package provides a fast lookup information from IP address by using IP2Location database.

License

Notifications You must be signed in to change notification settings

stdfox/ip2location-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This repository is no longer maintained

Issue reports and pull requests will not be attended.

IP2Location Java Package

This Java 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, and usage type 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, and usage type as values.

At this moment it supports only IPv4 address.

Example

import com.github.stdfox.ip2location.IP2Location;
import com.github.stdfox.ip2location.IP2LocationResult;

public class Application {
    public static void main(String[] args) {
        try {
            IP2Location ip2Location = new IP2Location("IP-COUNTRY-REGION-CITY-LATITUDE-LONGITUDE-ZIPCODE-TIMEZONE-ISP-DOMAIN-NETSPEED-AREACODE-WEATHER-MOBILE-ELEVATION-USAGETYPE-SAMPLE.BIN");
            IP2LocationResult result = ip2Location.query("8.8.8.8");

            System.out.println(result.country_code);
            System.out.println(result.country_name);
            System.out.println(result.city);
            System.out.println(result.isp);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Database

Free LITE databases are available at https://lite.ip2location.com upon registration.

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

About

This Java package provides a fast lookup information from IP address by using IP2Location database.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages