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;
}