Пример #1
0
function SendSMS($phonenumber, $message)
{
    $config = Config::get('sendSMSConfig', 'execEngine');
    $username = $config['username'];
    $password = $config['password'];
    $sender = $config['sender'];
    Notifications::addLog('Username = '******'ExecEngine');
    // Set the Messabeird username and password, and create an instance of the MessageBird class
    $sms = new MessageBird($username, $password);
    // Set the sender, could be a number (16 numbers) or letters (11 characters)
    $sms->setSender($sender);
    // Add the destination mobile number.
    // This method can be called several times to add have more then one recipient for the same message
    $sms->addDestination($phonenumber);
    //e.g. $sms->addDestination('31600000000');
    // Set an reference, optional
    // $sms->setReference('123456789');
    // Set a schedule date-time, optional
    // $sms->setTimestamp('2014-01-01 10:02');
    // Replace non GSM-7 characters by appropriate valid GSM-7 characters
    // $sms->setReplacechars(false);
    // If you want a dlr notification of the message send to another url then that you have set on the web site, you can use this parameter. Don't forget to set a reference!
    // $sms->setDlrUrl('http://www.example.com/dlr_url.php');
    // If $test is TRUE, then the message is not actually sent or scheduled, and there will be no credits deducted.
    // $sms->setTest(true);
    // Send the message to the destination(s)
    $sms->sendSms($message);
    Notifications::addLog("ResponseCode: " . $sms->getResponseCode(), 'ExecEngine');
    Notifications::addLog("ResponseMessage: " . $sms->getResponseMessage(), 'ExecEngine');
    Notifications::addLog("Balance: " . $sms->getCreditBalance(), 'ExecEngine');
}
Пример #2
0
 private static function pushNotification($SMSAddr, $message, $title = null, $url = null, $urltitle = null)
 {
     Notifications::addLog('UNTESTED !!! SMS[pushNotification' . ']; $SMSAddr=[' . $SMSAddr . ']; $message=[' . $message . ']; $title=[' . $title . ']; $url=[' . $url . ']; $urltitle=[' . $urltitle . ']', 'MESSAGING');
     /* Config params for SendSMS function of ExecEngine (using MessageBird.com)
      * Set the sender, could be a number (16 numbers) or letters (11 characters)
      * 
      */
     // Copy the following line to localSettings.php and provide settings
     // Config::set('sendSMSConfig', 'execEngine', array('username' => '', 'password' => '', 'sender' => ''));
     $config = Config::get('sendSMSConfig', 'msg_SMS');
     $username = $config['username'];
     $password = $config['password'];
     $sender = $config['sender'];
     Notifications::addLog('Username = '******'MESSAGING');
     // Set the Messagebird username and password, and create an instance of the MessageBird class
     $sms = new MessageBird($username, $password);
     // Set the sender, could be a number (16 numbers) or letters (11 characters)
     $sms->setSender($sender);
     // Add the destination mobile number.
     // This method can be called several times to add have more then one recipient for the same message
     $sms->addDestination($SMSAddr);
     //e.g. $sms->addDestination('31600000000');
     // Set an reference, optional
     // $sms->setReference('123456789');
     // Set a schedule date-time, optional
     // $sms->setTimestamp('2014-01-01 10:02');
     // Replace non GSM-7 characters by appropriate valid GSM-7 characters
     // $sms->setReplacechars(false);
     // If you want a dlr notification of the message send to another url then that you have set on the web site, you can use this parameter. Don't forget to set a reference!
     // $sms->setDlrUrl('http://www.example.com/dlr_url.php');
     // If $test is TRUE, then the message is not actually sent or scheduled, and there will be no credits deducted.
     Notifications::addLog("SMS testing is set to TRUE (messages are not actually sent)", 'MESSAGING');
     $sms->setTest(true);
     // Send the message to the destination(s)
     $sms->sendSms($message);
     if ($sms->getResponseCode() == "01") {
         Notifications::addSuccess('SMS message sent.');
     } else {
         Notifications::addError('SMS error: ' . $sms->getResponseMessage());
     }
     Notifications::addLog("SMS Response: " . $sms->getResponseMessage(), 'MESSAGING');
     Notifications::addLog("SMS Balance: " . $sms->getCreditBalance(), 'MESSAGING');
 }
Пример #3
0
<?php

/**
 * =======================================================================
 *  File:        example_form.php
 *  Author:      MessageBird B.V.
 *
 *  More information? Go to www.messagebird.com/sms-api
 *
 * This class requires that you have PHP 5.1.x or higher installed.
 * ========================================================================
 */
require_once 'lib/class.Messagebird.php';
// Set the Messabeird username and password, and create an instance of the MessageBird class
$sms = new MessageBird('username', 'password');
// Set the sender, could be an number (16 numbers) or letters (11 characters)
$sms->setSender('YourSender');
// Add the destination mobile number.
// This method can be called several times to add have more then one recipient for the same message
$sms->addDestination('31600000000');
// Set an reference, optional
$sms->setReference('123456789');
// Set a schedule date-time, optional
// $sms->setTimestamp('2014-01-01 10:02');
// Replace non GSM-7 characters by appropriate valid GSM-7 characters
// $sms->setReplacechars(false);
// If you want a dlr notification of the message send to another url then that you have set on the web site, you can use this parameter. Don't forget to set a reference!
// $sms->setDlrUrl('http://www.example.com/dlr_url.php');
// The message will be send as a voice message and the gateway_id will be overwritten to 8, which is the voice gateway. (Dutch only for the moment)
// $sms->setVoice(true);
// Set the quality of the route that you want to send the message.
 }
 // Check if sender is posted
 if (!empty($_POST['sender'])) {
     $sender = $_POST['sender'];
 } else {
     $sender = null;
 }
 // Check if reference is posted
 if (!empty($_POST['reference'])) {
     $reference = $_POST['reference'];
 } else {
     $reference = null;
 }
 // If we have the required parameters, we can send a message.
 if ($destination !== null && $message !== null && $sender !== null) {
     $sms = new MessageBird($username, $password);
     // Add the destination mobile number.
     // This method can be called several times to add have more then one recipient for the same message
     $sms->addDestination($destination);
     if ($sender !== null) {
         // Set the sender, could be an number (16 numbers) or letters (11 characters)
         $sms->setSender($sender);
     }
     if ($reference !== null) {
         // Set an reference
         $sms->setReference($reference);
     }
     // Send the message to the destination(s)
     $sms->sendSms($message);
     // Output the response to the browser
     echo '<br />Response Info:';
<?php

/**
 * =======================================================================
 *  File:        example_balance.php
 *  Author:      MessageBird B.V.
 *
 *  More information? Go to www.messagebird.com/sms-api
 *
 * This class requires that you have PHP 5.1.x or higher installed.
 * ========================================================================
 */
require_once 'lib/class.MessageBird.php';
// Set the Messabeird username and password, and create an instance of the MessageBird class
$sms = new MessageBird('username', 'password');
echo $sms->getBalance();