examples/GeoPlugin.php
public function getLocation($ip = '', $baseCurrency = '', $renameArrayKeys = false)
    {
        $params = [
            'ip'            => !$ip ? $_SERVER['REMOTE_ADDR'] : $ip,
            'base_currency' => $baseCurrency,
        ];

        $response = $this->client->get('json.gp', $params);

        $data = $this->handleResponseContent($response, 'json');

        if ($renameArrayKeys) {
            $tmpData = [];
            foreach ($data as $key => $value) {
                $tmpData[str_replace('geoplugin_', '', $key)] = $value;
            }
            $data = $tmpData;
        }

        return $data;
    }
public function getLocation($ip = '', $baseCurrency = '', $renameArrayKeys = false)
    {
        $params = [
            'ip'            => !$ip ? $_SERVER['REMOTE_ADDR'] : $ip,
            'base_currency' => $baseCurrency,
        ];

        $response = $this->client->get('json.gp', $params);

        $data = $this->handleResponseContent($response, 'json');

        if ($renameArrayKeys) {
            $tmpData = [];
            foreach ($data as $key => $value) {
                $tmpData[str_replace('geoplugin_', '', $key)] = $value;
            }
            $data = $tmpData;
        }

        return $data;
    }
public function getLocation ( $ ip = '' , $ baseCurrency = '' , $ renameArrayKeys = false ) { $ params = [ 'ip' => ! $ ip ? $ _SERVER [ 'REMOTE_ADDR' ] : $ ip , 'base_currency' => $ baseCurrency , ] ; $ response = $ this -> client -> get ( 'json.gp' , $ params ) ; $ data = $ this -> handleResponseContent ( $ response , 'json' ) ; if ( $ renameArrayKeys ) { $ tmpData = [ ] ; foreach ( $ data as $ key => $ value ) { $ tmpData [ str_replace ( 'geoplugin_' , '' , $ key ) ] = $ value ; } $ data = $ tmpData ; } return $ data ; }
Fetches the IP locatio info

@param string $ip
@param string $baseCurrency i.e.: "EUR"
@return array
Fetches the IP locatio info