Blesta Source Documentation

GeoIp extends AbstractGeoIp

GeoIP v1 integration

Table of Contents

Properties

$database

Methods

__construct() Create a new GeoIP instance using the given database file
__destruct() Attempts to close the open connection to the database file
getCountryCode() Returns the 2-character country code where the IP resides
getCountryName() Returns the name of the country where the IP resides
getIp() Returns the currently set IP address
getLocation() Fetches an array of information about the location of the IP address, including longitude and latitude.
getOrganization() Get the organization or ISP that owns the IP address. Requires a premium database.
getRegion() Get the region (e.g. state) of the given IP address.
setIp() Sets the Ip address to use for all subsequent queries
Properties

$database

private GeoIP $database

The GeoIP database object

Methods

__construct()

Create a new GeoIP instance using the given database file

public __construct(string $database_file) : mixed
Parameters
$database_file : string

The full path to the database file

__destruct()

Attempts to close the open connection to the database file

public __destruct() : mixed

getCountryCode()

Returns the 2-character country code where the IP resides

public getCountryCode() : string
Return values
string

The 2-character country code where the IP resides

getCountryName()

Returns the name of the country where the IP resides

public getCountryName() : string
Return values
string

The name of the country where the IP resides

getIp()

Returns the currently set IP address

public getIp() : string
Return values
string

The IP given in $ip, or the user's IP if $ip was null.

getLocation()

Fetches an array of information about the location of the IP address, including longitude and latitude.

public getLocation() : array<string|int, mixed>
Return values
array<string|int, mixed>

An array of information about the location of the IP address

getOrganization()

Get the organization or ISP that owns the IP address. Requires a premium database.

public getOrganization() : string
Return values
string

The oraganization the IP address belongs to

getRegion()

Get the region (e.g. state) of the given IP address.

public getRegion() : string
Return values
string

The region the IP address resides in

setIp()

Sets the Ip address to use for all subsequent queries

public setIp(string $ip) : mixed
Parameters
$ip : string

The Ip address to set

Tags
subpackage

core.Util.GeoIp

copyright

Copyright (c) 2019, Phillips Data, Inc.

license

http://www.blesta.com/license/ The Blesta License Agreement

link

Blesta


        
On this page

Search results