opensrs\Base::send_cmd PHP Метод

send_cmd() публичный Метод

Method to send a command to the server.
С версии: 3.1
public send_cmd ( string $request ) : string
$request string Raw XML request
Результат string $data Raw XML response
    public function send_cmd($request)
    {
        // make or get the socket filehandle
        if (!$this->init_socket()) {
            throw new Exception('oSRS Error - Unable to establish socket: (' . $this->_socketErrorNum . ') ' . $this->_socketErrorMsg);
        }
        $this->send_data($request);
        $data = $this->read_data();
        $num_matches = preg_match('/<item key="response_code">401<\\/item>/', $data, $matches);
        if ($num_matches > 0) {
            throw new Exception('oSRS Error - Reseller username or OSRS_KEY is incorrect, please check your config file.');
        }
        return $data;
    }