public function handleGetMsg() { $vnames = array('getMessage', 'messageId'); $this->copyToSession($vnames); if (!isset($_SESSION['getMessage'])) { return; } try { $msgId = $_SESSION['messageId']; $immnSrvc = new IMMNService($this->apiFQDN, $this->getSessionToken()); $this->clearSession(array('getMessage')); $msg = $immnSrvc->getMessage($msgId); $this->results[C_GET_MSG] = $msg; } catch (Exception $e) { $this->errors[C_GET_MSG] = $e->getMessage(); $this->clearSession(array('getMessage')); } }
/** * Retrieve the Message from Server * * @method getMessage * * @param {string} msgId - Id of the message to retrieve * * @return {Response} Returns Response object * @throws ServiceException if API request was not successful. */ public function getMessage($msgId) { // Get OAuth token $token = $this->getSessionConsentToken('MIM'); $immnSrvc = new IMMNService($this->base_url, $token); return $immnSrvc->getMessage($msgId, true); }
// Enter the number of messages to include in the list. $limit = 'ENTER VALUE!'; // Enter the offset to the first message. $offset = 'ENTER VALUE!'; // Send the request to get the message list. $msgList = $immnSrvc->getMessageList($limit, $offset); echo "total: " . $msgList->getTotal() . "\n"; } catch (ServiceException $se) { echo $se->getErrorResponse(); } /* This try/catch block tests the getMessage method. */ try { // Specify the id of the message to retrieve. $msgId = 'ENTER VALUE!'; // Send the request to get the message. $msg = $immnSrvc->getMessage($msgId); echo "msgId: " . $msg->getMessageId() . "\n"; } catch (ServiceException $se) { echo $se->getErrorResponse(); } /* This try/catch block tests the getMessageContent method. */ try { // Enter the id of the message. $msgId = 'ENTER VALUE!'; // Enter the id of the content to retrieve. $partId = 'ENTER VALUE!'; // Send the request to get the message content. $msgContent = $immnSrvc->getMessageContent($msgId, $partId); } catch (ServiceException $se) { echo $se->getErrorResponse(); }