当前位置: 首页>>代码示例>>PHP>>正文


PHP SMS::sendSMS方法代码示例

本文整理汇总了PHP中SMS::sendSMS方法的典型用法代码示例。如果您正苦于以下问题:PHP SMS::sendSMS方法的具体用法?PHP SMS::sendSMS怎么用?PHP SMS::sendSMS使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SMS的用法示例。


在下文中一共展示了SMS::sendSMS方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sendsmsAction

 function sendsmsAction()
 {
     $currentTime = date("Y-m-d H:i:s");
     $this->_helper->layout->disableLayout();
     if ($this->_request->isPost() && $this->_request->getParam("login_phone") != null) {
         try {
             $login_phone = $this->_request->getParam("login_phone");
             //verify email
             $consumerModel = new Consumer();
             $consumer = $consumerModel->fetchRow("login_phone = '" . $login_phone . "'");
             if ($consumer == null) {
                 $this->view->phoneErr = $this->view->translate('The_phone_is_not_existed');
                 return;
             }
             //generate reset password link
             $codePattern = '1234567890ABCDEFGHIJKLOMNOPQRSTUVWXYZ';
             $signup_auth_code = '';
             for ($codeCount = 0; $codeCount < 12; $codeCount++) {
                 $signup_auth_code = $signup_auth_code . $codePattern[mt_rand(0, 35)];
             }
             $resetPasswordLink = $this->view->home . '/public/forgetpassword/reset/p/' . $signup_auth_code;
             //save link into DB
             $tomorrow = mktime(date("H"), date("i"), date("s"), date("m"), date("d") + 1, date("Y"));
             $expire_date = date("Y-m-d H:i:s", $tomorrow);
             $temporaryLinkModel = new TemporaryLink();
             $temporaryLink = array("link" => $resetPasswordLink, "login_phone" => $login_phone, "expire_date" => $expire_date);
             $temporaryLink_id = $temporaryLinkModel->insert($temporaryLink);
             //send sms
             $newclient = new SMS();
             $mobile = $login_phone;
             $message = $this->view->translate('Forget_Password_SMS') . $signup_auth_code;
             $time = $currentTime;
             $apitype = 2;
             // $apitype 通道选择 0:默认通道; 2:通道2; 3:即时通道;
             $msg = iconv("UTF-8", "GB2312", $message);
             $respxml = $newclient->sendSMS($mobile, $msg, $time, $apitype);
             // crypt the login_phone, added by ZHL on 2011-11-25
             $this->view->crypt_login_phone = substr($login_phone, 0, 3) . "*****" . substr($login_phone, 8, 3);
         } catch (Exception $e) {
             //roll back...
             $this->view->phoneErr = $this->view->translate('Send_fail_Try_Again');
         }
     } else {
         $this->view->phoneErr = $this->view->translate('The_phone_is_not_existed');
     }
     // sms has been sent
     // $this->_helper->redirector('reset', 'forgetpassword');
 }
开发者ID:omusico,项目名称:wildfire_php,代码行数:48,代码来源:ForgetpasswordController.php

示例2: smsRecord

 /**
  * SMS a record.
  *
  * @return void
  * @access public
  */
 public function smsRecord()
 {
     // Load the appropriate SMS module based on the "type" parameter:
     $type = isset($_REQUEST['type']) ? $_REQUEST['type'] : 'Record';
     include_once 'services/' . $type . '/SMS.php';
     $sms = new SMS();
     $result = $sms->sendSMS();
     if (PEAR::isError($result)) {
         return $this->output(translate($result->getMessage()), JSON::STATUS_ERROR);
     }
     return $this->output(translate('sms_success'), JSON::STATUS_OK);
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:18,代码来源:JSON.php

示例3: SendSMS

 function SendSMS()
 {
     require_once ROOT_DIR . '/services/EcontentRecord/SMS.php';
     $searchObject = SearchObjectFactory::initSearchObject();
     $searchObject->init();
     $sms = new SMS();
     $result = $sms->sendSMS();
     if (PEAR_Singleton::isError($result)) {
         return '<result>Error</result>';
     } else {
         if ($result === true) {
             return '<result>Done</result>';
         } else {
             return '<result><![CDATA[' . $result . ']]></result>';
         }
     }
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:17,代码来源:AJAX.php

示例4: adminreportbatchreplysendAction

 function adminreportbatchreplysendAction()
 {
     $this->_helper->layout->setLayout("layout_admin");
     ini_set('display_errors', 1);
     $frontController = Zend_Controller_Front::getInstance();
     $frontController->throwExceptions(true);
     if ($this->_request->isPost()) {
         $form = new ReplyReportForm();
         $formData = $this->_request->getPost();
         if ($form->isValid($formData)) {
             //print_r($formData);die;
             $reportSource = $this->_request->getParam('report_source');
             // sms report:
             if ($reportSource == 'sms') {
                 $db = Zend_Registry::get('db');
                 $select = $db->select();
                 $select->from('consumer', '*');
                 $select->where('id = ?', $this->_request->getParam('consumer_id'));
                 $consumer = $db->fetchAll($select);
                 // 1.send reply
                 $msmStr = $form->getValue('message');
                 $len = strlen($msmStr);
                 for ($i = 0, $msmStrLen = 0; $i < $len; $i++, $msmStrLen++) {
                     if (ord($msmStr[$i]) >= 128) {
                         $i = $i + 2;
                     }
                 }
                 if ($msmStrLen > 70) {
                     $this->view->batchId = $formData['batch_id'];
                     $this->view->showMessage = 'Reply fail: The sms should be short then 70 characters.';
                     return;
                 }
                 include_once 'sms.inc.php';
                 $newclient = new SMS();
                 $apitype = 0;
                 $msg = iconv("UTF-8", "GB2312", $form->getValue('message'));
                 $respxml = $newclient->sendSMS($form->getValue('email'), $msg, date("Y-m-d H:i:s"), $apitype);
                 // 2.save reply
                 $replyModel = new Reply();
                 $reply = $replyModel->fetchRow('report_id = ' . $this->_request->getParam('report_id'));
                 //check reply condition!
                 if ($reply != null && $reply->status == 'SENT') {
                     $this->view->showMessage = "Reply fail: the reply has been sent!";
                     return;
                 }
                 if ($reply == null) {
                     $replyModel = new Reply();
                     $reply = $replyModel->createRow();
                 }
                 $currentTime = date("Y-m-d H:i:s");
                 $reply->date = $currentTime;
                 $reply->subject = $form->getValue('subject');
                 $reply->content = $form->getValue('message');
                 $reply->from = $config->smtp->report->mail->username;
                 $reply->campaign_id = $formData['campaign_id'];
                 $reply->report_id = $formData['report_id'];
                 $reply->to = $form->getValue('email');
                 $reply->status = 'SENT';
                 //2011-04-08 ham.bao separate the sessions with admin
                 $reply->admin_id = $this->_currentAdmin->id;
                 //$reply->usetime =$formData['usetime'];
                 $reply->save();
                 // 3.grade
                 $report_id = (int) $this->_request->getParam('report_id');
                 $this->saveReportReward($report_id, $form->getValue('grade'));
                 // 4.update notes for report
                 //$this->saveTags($report_id,$formData ['report_id']);
                 $this->saveTags($report_id, $formData['note']);
                 $this->view->batchId = $formData['batch_id'];
                 $this->updateBatchTotaltime($formData['batch_id'], $addtive);
                 $this->view->showMessage = $this->view->translate('Admin_Reply_the_report_successfully');
                 return;
             }
             // email report:
             //1. config
             $config = Zend_Registry::get('config');
             /* 
             $smtpSender = new Zend_Mail_Transport_Smtp(
             			$config->smtp->report->mail->server,
             			array(
             				'username'=> $config->smtp->report->mail->username,
             				'password'=> $config->smtp->report->mail->password,
             				'auth'=> $config->smtp->report->mail->auth,
             				'ssl' => $config->smtp->report->mail->ssl,
             			               			'port' => $config->smtp->report->mail->port));
             Zend_Mail::setDefaultTransport($smtpSender);
             $mail = new Zend_Mail('utf-8');
             */
             $db = Zend_Registry::get('db');
             $select = $db->select();
             $select->from('consumer', '*');
             $select->where('email = ?', $form->getValue('email'));
             $consumer = $db->fetchAll($select);
             if ($consumer[0] != null) {
                 /*
                 //2.get "Your story" from report
                 $reportId = $formData['report_id'];
                 				    	$reportModel = new Report();
                 				    	$report = $reportModel->find($reportId)->current();
                 				    	$config = Zend_Registry::get('config');
//.........这里部分代码省略.........
开发者ID:omusico,项目名称:wildfire_php,代码行数:101,代码来源:ReportController.php

示例5: SMS

<?php

require_once "./includes/initialize.php";
$bmlist = man_power::BMlist2('BETWEEN 1 AND 25');
foreach ($bmlist as $BM) {
    $message = "Dear " . $BM->BM_Name . "," . PHP_EOL;
    $message .= "The Mebapp reporting system will be active only for today.Login now to share your team's performance for Go-Make A Difference." . PHP_EOL . "Regards" . PHP_EOL . "Cipla Respiratory";
    $sendSMS = new SMS();
    $sendSMS->sendSMS($BM->BM_Mobile, $message);
}
开发者ID:Akshayf444,项目名称:breathfree,代码行数:10,代码来源:7pms1.php

示例6: sendcouponAction

 function sendcouponAction()
 {
     $this->_helper->layout->setLayout("layout_coupon");
     $currentTime = date("Y-m-d H:i:s");
     $endTime = date("Y年m月d日", strtotime("+7 day"));
     $couponId = (int) $this->_request->getParam('uid');
     //$message = $this->getCouponById($couponId);
     //var_dump($_SERVER['HTTP_REFERER']);die;
     $lou = 0;
     if (isset($_SERVER['HTTP_REFERER']) && preg_match('/19lou/', $_SERVER['HTTP_REFERER'])) {
         $lou = 1;
         $_SESSION['19lou'] = 1;
     }
     if (isset($_SESSION['19lou'])) {
         $lou = 1;
     }
     //var_dump($_SESSION);die;
     $this->view->message = array();
     $this->view->coupon = $couponId;
     if ($this->_request->isPost()) {
         $formData = $this->_request->getPost();
         if (trim($formData['username']) == '') {
             $this->view->message['username'] = '姓名不能为空。';
         }
         if (trim($formData['telephone']) == '') {
             $this->view->message['telephone'] = '手机号码不能为空。';
         }
         if (trim($couponId) == '') {
             $this->view->message['coupon'] = '没有对应的优惠券。';
         }
         $this->view->postData = $formData;
         if (trim($formData['telephone']) != '' && $this->validateSend($formData['telephone'], $couponId, $lou)) {
             $this->view->message['got'] = '已经领取优惠券或同一天固定IP只能领取一份。';
         }
         //print_r($formData);die;
         if (!count($this->view->message)) {
             $newclient = new SMS();
             if ($newclient->ConfNull == "1") {
                 $mobile = $formData['telephone'];
                 $message = $this->getCouponById($couponId);
                 $time = $currentTime;
                 //echo str_replace('{date}',$endTime,$message['content']);die;
                 $apitype = 3;
                 // $apitype 通道选择 0:默认通道; 2:通道2; 3:即时通道;
                 $msg = iconv("UTF-8", "GB2312", str_replace('{date}', $endTime, $message['content']));
                 //				Zend_Debug::dump($msg);
                 $respxml = $newclient->sendSMS($mobile, $msg, $time, $apitype);
                 //print_r($newclient->sendXML);die();
                 $smsSpace = new Zend_Session_Namespace('SMS');
                 $smsSpace->xml = $newclient->sendXML;
                 $smsSpace->respxml = $respxml;
                 $this->view->code = $newclient->getCode();
                 if ($this->view->code == 2000) {
                     $this->view->message['susess'] = "成功领取优惠券.";
                     //add the coupon history
                     $db = Zend_Registry::get('db');
                     $insetSql = $db->prepare("insert into coupon_history(telephone,ip,crdate,cuid) values ('{$formData['telephone']}','{$_SERVER['REMOTE_ADDR']}','{$currentTime}',{$couponId})");
                     $insetSql->execute();
                 } else {
                     $this->view->message['telephone'] = '手机号码可能不正确。';
                 }
             } else {
                 $this->view->message['fail'] = "失败";
                 $this->view->message['noconfig'] = "你还没有配置文件";
             }
         }
     }
 }
开发者ID:omusico,项目名称:wildfire_php,代码行数:68,代码来源:SmsController.php

示例7: date

<?php

require_once "./includes/initialize.php";
$date = date('Y-m-d');
$sql = "SELECT \n  GROUP_CONCAT(DISTINCT(BM_Name)) AS BM_Name,\n  `SM_Emp_Id`,\n  `SM_Name`,\n  `SM_Mobile` \nFROM\n  `respi2_manpower` \nWHERE BM_Emp_Id NOT IN \n  (\n  SELECT DISTINCT \n    (BM_Emp_ID) \n  FROM\n    `respi2_activity` \n  WHERE DATE_FORMAT(created, '%Y-%m-%d') = '{$date}') GROUP BY `SM_Emp_Id` ";
$result = Query::executeQuery($sql);
foreach ($result as $value) {
    $message = "Dear " . $value->SM_Name . "," . PHP_EOL;
    $message .= "Following BMs have not reported today : " . $value->BM_Name;
    $sendSMS = new SMS();
    //echo $message.'<br/>';
    $sendSMS->sendSMS($value->SM_Mobile, $message);
}
开发者ID:Akshayf444,项目名称:respi2,代码行数:13,代码来源:NotRespond.php


注:本文中的SMS::sendSMS方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。