public function rconExec($password, $command) {
        if($this->rconChallenge == -1 || $this->isHLTV) {
            $this->rconGetChallenge();
        }

        $this->rconSend("rcon {$this->rconChallenge} $password $command");
        if($this->isHLTV) {
            try {
                $response = $this->getReply()->getResponse();
            } catch(\SteamCondenser\Exceptions\TimeoutException $e) {
                $response = '';
            }
        } else {
            $response = $this->getReply()->getResponse();
        }

        if(trim($response) == 'Bad rcon_password.') {
            throw new \SteamCondenser\Exceptions\RCONNoAuthException();
        } elseif(trim($response) == 'You have been banned from this server.') {
            throw new \SteamCondenser\Exceptions\RCONBanException();
        }

        $this->rconSend("rcon {$this->rconChallenge} $password");

        do {
            $responsePart = $this->getReply()->getResponse();
            $response .= $responsePart;
        } while(strlen($responsePart) > 0);

        return $response;
    }
public function rconExec($password, $command) {
        if($this->rconChallenge == -1 || $this->isHLTV) {
            $this->rconGetChallenge();
        }

        $this->rconSend("rcon {$this->rconChallenge} $password $command");
        if($this->isHLTV) {
            try {
                $response = $this->getReply()->getResponse();
            } catch(\SteamCondenser\Exceptions\TimeoutException $e) {
                $response = '';
            }
        } else {
            $response = $this->getReply()->getResponse();
        }

        if(trim($response) == 'Bad rcon_password.') {
            throw new \SteamCondenser\Exceptions\RCONNoAuthException();
        } elseif(trim($response) == 'You have been banned from this server.') {
            throw new \SteamCondenser\Exceptions\RCONBanException();
        }

        $this->rconSend("rcon {$this->rconChallenge} $password");

        do {
            $responsePart = $this->getReply()->getResponse();
            $response .= $responsePart;
        } while(strlen($responsePart) > 0);

        return $response;
    }
public function rconExec ( $ password , $ command ) { if ( $ this -> rconChallenge == - 1 || $ this -> isHLTV ) { $ this -> rconGetChallenge ( ) ; } $ this -> rconSend ( "rcon {$this->rconChallenge} $password $command" ) ; if ( $ this -> isHLTV ) { try { $ response = $ this -> getReply ( ) -> getResponse ( ) ; } catch ( \ SteamCondenser \ Exceptions \ TimeoutException $ e ) { $ response = '' ; } } else { $ response = $ this -> getReply ( ) -> getResponse ( ) ; } if ( trim ( $ response ) == 'Bad rcon_password.' ) { throw new \ SteamCondenser \ Exceptions \ RCONNoAuthException ( ) ; } elseif ( trim ( $ response ) == 'You have been banned from this server.' ) { throw new \ SteamCondenser \ Exceptions \ RCONBanException ( ) ; } $ this -> rconSend ( "rcon {$this->rconChallenge} $password" ) ; do { $ responsePart = $ this -> getReply ( ) -> getResponse ( ) ; $ response .= $ responsePart ; } while ( strlen ( $ responsePart ) > 0 ) ; return $ response ; }
Executes the given command on the server via RCON

@param string $password The password to authenticate with the server
@param string $command The command to execute on the server
@return RCONGoldSrcResponse The response replied by the server
@see rconChallenge()
@see rconSend()
@throws RCONBanException if the IP of the local machine has been banned
on the game server
@throws RCONNoAuthException if the password is incorrect
Executes the given command on the server via RCON