Piwik\
Contains IP address helper functions (for both IPv4 and IPv6).
As of Matomo (formerly Piwik) 2.9, most methods in this class are deprecated. You are encouraged to use classes from the Matomo "Network" component:
The class defines the following methods:
getIpFromHeader()
— Returns the most accurate IP address available for the current user, in IPv4 format.getNonProxyIpFromHeader()
— Returns a non-proxy IP address from header.getFirstIpFromList()
— Returns the last IP address in a comma separated list, subject to an optional exclusion list.getLastIpFromList()
getIpFromHeader()
Returns the most accurate IP address available for the current user, in IPv4 format. This could be the proxy client's IP address.
string
—
IP address in presentation format.getNonProxyIpFromHeader()
Returns a non-proxy IP address from header.
$default
(string
) —
Default value to return if there no matching proxy header.$proxyHeaders
(array
) —
List of proxy headers.string
value.getFirstIpFromList()
Returns the last IP address in a comma separated list, subject to an optional exclusion list.
It accepts the following parameter(s):
$csv
(string
) —
Comma separated list of elements.$excludedIps
(array
) —
Optional list of excluded IP addresses (or IP address ranges).Returns: string
—
Last (non-excluded) IP address in the list or an empty string if all given IPs are excluded.
getLastIpFromList()
It accepts the following parameter(s):
$csv
$excludedIps
It does not return anything or a mixed result.