beranek1 / php-geoip

Retrieves the geolocation of IP addresses using RDAP and hostnames.

Home Page:https://geoip.beranek.one

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GeoIP

PHP Library for retrieving the geolocation of ip addresses.

Usage

All you need to do is including "geoip.php":

include  "geoip.php";

GeoIP consists of 4 functions:

  • get_country_by_host($host)
  • get_country_by_ip($ip)
  • get_country_by_rdap($query)
  • get_continent_by_country($country)

What they do is already obvious by their name, the return value is either a two character country/continent code or null if the location is unknown.

"get_country_by_rdap($query)" uses the RDAP protocol for getting the ip address' location, works for all european ones.

Affiliated projects

About

Retrieves the geolocation of IP addresses using RDAP and hostnames.

https://geoip.beranek.one

License:MIT License


Languages

Language:PHP 100.0%