private function handleSendMMS()
 {
     if (!isset($_REQUEST['address'])) {
         return;
     }
     try {
         $this->copyToSession(array('address', 'subject', 'attachment', 'chkGetOnlineStatus'));
         $addr = Util::convertAddresses($_REQUEST['address']);
         $addr = count($addr) == 1 ? $addr[0] : $addr;
         $subject = $_REQUEST['subject'];
         $attachment = $_REQUEST['attachment'];
         $attachArr = array();
         if (strcmp($attachment, '') != 0) {
             $attachArr = array('attachment/' . $attachment);
         }
         $notifyDeliveryStatus = isset($_REQUEST['chkGetOnlineStatus']);
         $srvc = new MMSService($this->apiFQDN, $this->getFileToken());
         $response = $srvc->sendMMS($addr, $attachArr, $subject, null, $notifyDeliveryStatus);
         if (!$notifyDeliveryStatus) {
             $_SESSION['id'] = $response->getMessageId();
         }
         $this->results[MMSController::RESULT_SEND_MMS] = $response;
     } catch (Exception $e) {
         $this->errors[MMSController::ERROR_SEND_MMS] = $e->getMessage();
     }
 }
 private function _handleSendSMS()
 {
     if (!isset($_REQUEST['sendSMS'])) {
         return;
     }
     try {
         $rawaddrs = $_REQUEST['address'];
         $_SESSION['rawaddrs'] = $rawaddrs;
         $addrArray = Util::convertAddresses($rawaddrs);
         $addr = count($addrArray) == 1 ? $addrArray[0] : $addrArray;
         $msg = $_REQUEST['message'];
         $getNotification = isset($_REQUEST['chkGetOnlineStatus']);
         $srvc = new SMSService($this->apiFQDN, $this->getFileToken());
         $result = $srvc->sendSMS($addr, $msg, $getNotification);
         if (!$getNotification) {
             $_SESSION['SmsId'] = $result->getMessageId();
         }
         $this->results[SMSController::RESULT_SEND_SMS] = $result;
     } catch (Exception $e) {
         $this->errors[SMSController::ERROR_SEND_SMS] = $e->getMessage();
     }
 }
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
session_start();
require_once __DIR__ . '/common.php';
require_once __DIR__ . '/../lib/IMMN/IMMNService.php';
require_once __DIR__ . '/../lib/Util/Util.php';
use Att\Api\IMMN\IMMNService;
use Att\Api\Util\Util;
$arr = null;
try {
    envinit();
    $immnSrvc = new IMMNService(getFqdn(), getSessionToken());
    $addrs = Util::convertAddresses($_POST['address']);
    $msg = $_POST['sendMsgInput'];
    $subject = $_POST['sendSubjectInput'];
    $group = isset($_POST['groupCheckbox']);
    $id = $immnSrvc->sendMessage($addrs, $msg, $subject, null, $group);
    $arr = array('success' => true, 'text' => 'id: ' . $id);
} catch (Exception $e) {
    $arr = array('success' => false, 'text' => $e->getMessage());
}
echo json_encode($arr);
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */