Example #1
0
 /**
  * Sends a command, checks the reponse, and
  * if good returns the reponse, other wise
  * returns false.
  *
  * @param  $cmd  Command to send (\r\n will be appended)
  *
  * @return mixed First line of response if successful, otherwise false
  */
 function _sendCmd($cmd)
 {
     $result = $this->_socket->writeLine($cmd);
     if (PEAR::isError($result) and $result) {
         return $result;
     }
     $data = $this->_socket->readLine();
     if (PEAR::isError($data)) {
         return $data;
     }
     $resp['code'] = substr($data, 0, 3);
     $resp['text'] = ltrim(substr($data, 3));
     if (!Net_Dict::isOK($resp)) {
         return new PEAR_Error($resp['text'], $resp['code']);
     }
     return $resp;
 }