public function getIPBasedCountry()
    {
        $ip = $this->getClientIP();
        $url = self::GEOCODE_SERVICE_URL.$ip;
        $result = file_get_contents($url);
        switch ($result[0]) {
            case '1':
                $data = explode(';', $result);

                return $data[1];
                break;
            default:
                return false;
        }
    }
public function getIPBasedCountry()
    {
        $ip = $this->getClientIP();
        $url = self::GEOCODE_SERVICE_URL.$ip;
        $result = file_get_contents($url);
        switch ($result[0]) {
            case '1':
                $data = explode(';', $result);

                return $data[1];
                break;
            default:
                return false;
        }
    }
public function getIPBasedCountry ( ) { $ ip = $ this -> getClientIP ( ) ; $ url = self :: GEOCODE_SERVICE_URL . $ ip ; $ result = file_get_contents ( $ url ) ; switch ( $ result [ 0 ] ) { case '1' : $ data = explode ( ';' , $ result ) ; return $ data [ 1 ] ; break ; default : return false ; } }
Returns the ISO 3166-1 alpha-2 two letter
country code for the client IP. If the
IP can't be resolved it returns false.

@return bool|string
Returns the ISO 3166 - 1 alpha - 2 two letter country code for the client IP . If the IP can t be resolved it returns false .