src/PHPClientAddr/PHPClientAddr.php
private function getXForwardedIp($entries)
    {
        $ip = $this->ip;
        while (list(, $entry) = each($entries)) {
            $entry = trim($entry);
            if ( preg_match("/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/", $entry, $ip_list)) {
                $found_ip = preg_replace( $this->privateIp, $ip, $ip_list[1]);

                if ($ip != $found_ip) {
                    $ip = $found_ip;
                    break;
                }
            }
        }
        return $ip;
    }
private function getXForwardedIp($entries)
    {
        $ip = $this->ip;
        while (list(, $entry) = each($entries)) {
            $entry = trim($entry);
            if ( preg_match("/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/", $entry, $ip_list)) {
                $found_ip = preg_replace( $this->privateIp, $ip, $ip_list[1]);

                if ($ip != $found_ip) {
                    $ip = $found_ip;
                    break;
                }
            }
        }
        return $ip;
    }
private function getXForwardedIp ( $ entries ) { $ ip = $ this -> ip ; while ( list ( , $ entry ) = each ( $ entries ) ) { $ entry = trim ( $ entry ) ; if ( preg_match ( "/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/" , $ entry , $ ip_list ) ) { $ found_ip = preg_replace ( $ this -> privateIp , $ ip , $ ip_list [ 1 ] ) ; if ( $ ip != $ found_ip ) { $ ip = $ found_ip ; break ; } } } return $ ip ; }
Permite obtener la IP real proveniente de un servidor proxy.
@param  array $entries Arreglo de entidades enviadas por un servidor proxy
@return string
Permite obtener la IP real proveniente de un servidor proxy .