lib/SteamCondenser/Servers/SourceServer.php
public function rconExec($command) {
        if(!$this->rconAuthenticated) {
            throw new RCONNoAuthException();
        }

        $this->rconSocket->send(new Packets\RCON\RCONExecRequest($this->rconRequestId, $command));

        $isMulti = false;
        $response = [];
        do {
            $responsePacket = $this->rconSocket->getReply();

            if ($responsePacket == null ||
                    $responsePacket instanceof Packets\RCON\RCONAuthResponse) {
                $this->rconAuthenticated = false;
                throw new RCONNoAuthException();
            }

            if (!$isMulti && strlen($responsePacket->getResponse()) > 0) {
                $isMulti = true;
                $this->rconSocket->send(new Packets\RCON\RCONTerminator($this->rconRequestId));
            }

            $response[] = $responsePacket->getResponse();
        } while($isMulti && !(empty($response[sizeof($response) - 2]) && empty($response[sizeof($response) - 1])));

        return trim(join('', $response));
    }
public function rconExec($command) {
        if(!$this->rconAuthenticated) {
            throw new RCONNoAuthException();
        }

        $this->rconSocket->send(new Packets\RCON\RCONExecRequest($this->rconRequestId, $command));

        $isMulti = false;
        $response = [];
        do {
            $responsePacket = $this->rconSocket->getReply();

            if ($responsePacket == null ||
                    $responsePacket instanceof Packets\RCON\RCONAuthResponse) {
                $this->rconAuthenticated = false;
                throw new RCONNoAuthException();
            }

            if (!$isMulti && strlen($responsePacket->getResponse()) > 0) {
                $isMulti = true;
                $this->rconSocket->send(new Packets\RCON\RCONTerminator($this->rconRequestId));
            }

            $response[] = $responsePacket->getResponse();
        } while($isMulti && !(empty($response[sizeof($response) - 2]) && empty($response[sizeof($response) - 1])));

        return trim(join('', $response));
    }
Remotely executes a command on the server via RCON

@param string $command The command to execute on the server via RCON
@return string The output of the executed command
@see rconAuth()
@throws RCONNoAuthException if not authenticated with the server
@throws SteamCondenserException if a problem occurs while parsing the
reply
@throws TimeoutException if the request times out