private function request($params)
 {
     $params['username'] = $this->username;
     $params['password'] = $this->password;
     if (empty($this->conn['fd'])) {
         if (!M_Connect($this->conn)) {
             throw new MonetraException(__(M_ConnectionError($this->conn)));
         }
     }
     $identifier = M_TransNew($this->conn);
     foreach ($params as $key => $value) {
         M_TransKeyVal($this->conn, $identifier, $key, $value);
     }
     return $this->executeRequest($identifier);
 }
Example #2
0
    return;
}
echo "connected\r\n";
/* Allocate new transaction */
$identifier = M_TransNew($conn);
/* User credentials */
M_TransKeyVal($conn, $identifier, "username", $MYUSER);
M_TransKeyVal($conn, $identifier, "password", $MYPASS);
/* Transaction Type */
M_TransKeyVal($conn, $identifier, "action", "admin");
M_TransKeyVal($conn, $identifier, "admin", "GUT");
echo "Sending Unsettled report request...\r\n";
/* Additional Auditing parameters may be specified
 * Please consult the Monetra Client Interface Protocol */
if (!M_TransSend($conn, $identifier)) {
    echo "Communication Error: " . M_ConnectionError($conn) . "\r\n";
    /* Free memory associated with conn */
    M_DestroyConn($conn);
    return;
}
echo "Response received\r\n";
/* We do not have to perform the M_Monitor() loop
 * because we are in blocking mode */
if (M_ReturnStatus($conn, $identifier) != M_SUCCESS) {
    echo "Audit failed\r\n";
    M_DestroyConn($conn);
    return;
}
if (!M_IsCommaDelimited($conn, $identifier)) {
    echo "Not a comma delimited response!\r\n";
    M_DestroyConn($conn);
 function MCVE_ConnectionError(&$conn)
 {
     return M_ConnectionError($conn);
 }