TeamSpeak3/Adapter/ServerQuery.php
public function request($cmd, $throw = true)
    {
        $query = StringHelper::factory($cmd)->section(TeamSpeak3::SEPARATOR_CELL);

        if (strstr($cmd, "\r") || strstr($cmd, "\n")) {
            throw new Ts3Exception("illegal characters in command '" . $query . "'");
        } elseif (in_array($query, $this->block)) {
            throw new Ts3Exception("command not found", 0x100);
        }

        Signal::getInstance()->emit("serverqueryCommandStarted", $cmd);

        $this->getProfiler()->start();
        $this->getTransport()->sendLine($cmd);
        $this->timer = time();
        $this->count++;

        $rpl = array();

        do {
            $str = $this->getTransport()->readLine();
            $rpl[] = $str;
        } while ($str instanceof StringHelper && $str->section(
                TeamSpeak3::SEPARATOR_CELL
            ) != TeamSpeak3::ERROR);

        $this->getProfiler()->stop();

        $reply = new Reply($rpl, $cmd, $this->getHost(), $throw);

        Signal::getInstance()->emit("serverqueryCommandFinished", $cmd, $reply);

        return $reply;
    }
public function request($cmd, $throw = true)
    {
        $query = StringHelper::factory($cmd)->section(TeamSpeak3::SEPARATOR_CELL);

        if (strstr($cmd, "\r") || strstr($cmd, "\n")) {
            throw new Ts3Exception("illegal characters in command '" . $query . "'");
        } elseif (in_array($query, $this->block)) {
            throw new Ts3Exception("command not found", 0x100);
        }

        Signal::getInstance()->emit("serverqueryCommandStarted", $cmd);

        $this->getProfiler()->start();
        $this->getTransport()->sendLine($cmd);
        $this->timer = time();
        $this->count++;

        $rpl = array();

        do {
            $str = $this->getTransport()->readLine();
            $rpl[] = $str;
        } while ($str instanceof StringHelper && $str->section(
                TeamSpeak3::SEPARATOR_CELL
            ) != TeamSpeak3::ERROR);

        $this->getProfiler()->stop();

        $reply = new Reply($rpl, $cmd, $this->getHost(), $throw);

        Signal::getInstance()->emit("serverqueryCommandFinished", $cmd, $reply);

        return $reply;
    }
Sends a prepared command to the server and returns the result.

@param  string $cmd
@param  boolean $throw
@throws Ts3Exception
@throws Ts3Exception
@return Reply