예제 #1
1
파일: send-sms.php 프로젝트: bayuhafiz/sms
<?php

include "lib/NexmoMessage.php";
// Step 1: Declare new NexmoMessage.
$no = $_POST['phone_no'];
$txt = $_POST['sms_body'];
$nexmo_sms = new NexmoMessage('6e4d6866', '2af8f65e');
// Step 2: Use sendText( $to, $from, $message ) method to send a message.
$info = $nexmo_sms->sendText($no, 'Clr-bld/sms-service', $txt);
// Step 3: Display an overview of the message
echo $nexmo_sms->displayOverview($info);
// Done!
예제 #2
0
 public function inform_insert_client($data, $msg, $term_num)
 {
     $adder = $this->db->prepare("INSERT INTO msg_details (number,message,termid)\n                        VALUES(:number,:message,:termid)");
     $adder->execute(array(':number' => $data, ':message' => $msg, 'termid' => $term_num));
     include "public/sms/src/NexmoMessage.php";
     $nexmo_sms = new NexmoMessage('32a68cfb', '597cecf7');
     $info = $nexmo_sms->sendText($data, 'TrainXLIfe', $msg);
     echo $nexmo_sms->displayOverview($info);
 }
예제 #3
0
 /**
  * @return mixed
  */
 public function send($to, $message, $title = "")
 {
     include_once Kohana::find_file('vendor', 'nexmo/NexmoMessage');
     if (!isset($this->_client)) {
         $this->_client = new NexmoMessage($this->_options['api_key'], $this->_options['api_secret']);
     }
     // Send!
     try {
         $info = $this->_client->sendText('+' . $to, '+' . preg_replace("/[^0-9,.]/", "", $this->from()), $message);
         foreach ($info->messages as $message) {
             if ($message->status != 0) {
                 Kohana::$log->add(Log::ERROR, 'Nexmo: ' . $message->errortext);
                 return array(Message_Status::FAILED, FALSE);
             }
             return array(Message_Status::SENT, $message->messageid);
         }
     } catch (Exception $e) {
         Kohana::$log->add(Log::ERROR, $e->getMessage());
     }
     return array(Message_Status::FAILED, FALSE);
 }
예제 #4
0
<?php

include "NexmoMessage.php";
/**
 * To send a text message.
 *
 */
// Step 1: Declare new NexmoMessage.
$nexmo_sms = new NexmoMessage('api_key', 'api_secret');
// Step 2: Use sendText( $to, $from, $message ) method to send a message.
$info = $nexmo_sms->sendText('+447234567890', 'MyApp', 'Hello!');
// Step 3: Display an overview of the message
echo $nexmo_sms->displayOverview($info);
// Done!
예제 #5
0
 public function nexmo($to, $message)
 {
     if ($this->settings['nexmoApiKey'] == "" || $this->settings['nexmoApiSecret'] == "") {
         return;
     }
     $nexmo_sms = new NexmoMessage($this->settings['nexmoApiKey'], $this->settings['nexmoApiSecret']);
     $info = $nexmo_sms->sendText($to, $this->title, $message);
 }
예제 #6
0
 public function SendSms($contact)
 {
     include "/libs/sms/src/NexmoMessage.php";
     $newCon = substr($contact, 1);
     // Step 1: Declare new NexmoMessage.
     $nexmo_sms = new NexmoMessage('e3a975e2', 'ffdd4630');
     // Step 2: Use sendText( $to, $from, $message ) method to send a message.
     $info = $nexmo_sms->sendText('+94' . $newCon, 'IOC', 'Dear Customer your Carwash service is done. You can collect your vehicle at our service station. Thank You for using our service.');
     // Step 3: Display an overview of the message
     echo $nexmo_sms->displayOverview($info);
     // Done!
 }
예제 #7
0
             if ($lsdb->affected_rows == 0) {
                 $result = $lsdb->query('SELECT phonenumber FROM ' . DB_PREFIX . 'user WHERE access = 1 AND available = 0 AND phonenumber != "" AND (departments = 0 OR FIND_IN_SET(' . $depsql . ', departments)) AND FIND_IN_SET("' . date("D") . '", tw_days) AND (TIME(NOW()) >= tw_time_from AND TIME(NOW()) <= tw_time_to)');
                 if ($lsdb->affected_rows > 0) {
                     if (LS_TWILIO_NEXMO) {
                         require 'include/twilio/Twilio.php';
                         $client = new Services_Twilio(base64_decode(LS_TW_SID), base64_decode(LS_TW_TOKEN));
                         while ($row = $result->fetch_assoc()) {
                             $message = $client->account->sms_messages->create(LS_TW_PHONE, $row['phonenumber'], LS_TW_MSG);
                         }
                     } else {
                         include 'include/nexmo/NexmoMessage.php';
                         while ($row = $result->fetch_assoc()) {
                             // Step 1: Declare new NexmoMessage. (Api Key) (Api Secret)
                             $nexmo_sms = new NexmoMessage(base64_decode(LS_TW_SID), base64_decode(LS_TW_TOKEN));
                             // Step 2: Use sendText( $to, $from, $message ) method to send a message.
                             $info = $nexmo_sms->sendText($row['phonenumber'], LS_TITLE, LS_TW_MSG);
                         }
                     }
                 }
             }
         }
     }
     // Redirect page
     $gochat = LS_rewrite::lsParseurl('chat', $_POST['slide_chat'], $_POST['lang'], '', '');
     /* Outputtng the error messages */
     if ($_SERVER['HTTP_X_REQUESTED_WITH']) {
         header('Cache-Control: no-cache');
         die(json_encode(array('login' => 1, 'link' => html_entity_decode($gochat))));
     }
     ls_redirect(html_entity_decode($gochat));
 }