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


PHP sms类代码示例

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


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

示例1: handle_inbox

 function handle_inbox()
 {
     if (!$_REQUEST['msisdn']) {
         return;
     }
     extract($_REQUEST);
     $data = array('text' => $text, 'message_id' => $messageId, 'msisdn' => $msisdn, 'type' => $type, 'to' => $to, 'keyword' => $keyword, 'timestamp' => $_REQUEST['message-timestamp']);
     $sms = new sms($data);
     $sms->save_inbound();
     header("HTTP/1.1 200 OK");
     exit;
 }
开发者ID:xflash8,项目名称:staff-2016,代码行数:12,代码来源:sms-inbound.card.php

示例2: index

 function index()
 {
     $variables = ORM::factory('private_gateway')->find_all();
     foreach ($variables as $variable) {
         $phonenumber = $variable->phonenumber_variable;
         $message = $variable->message_variable;
     }
     if (isset($_GET['key'])) {
         $private_gateway_key = $_GET['key'];
     }
     if (isset($_GET[$phonenumber])) {
         $message_from = $_GET[$phonenumber];
         // Remove non-numeric characters from string
         $message_from = preg_replace("#[^0-9]#", "", $message_from);
     }
     if (isset($_GET[$message])) {
         $message_description = $_GET[$message];
     }
     if (!empty($private_gateway_key) and !empty($message_from) and !empty($message_description)) {
         // Is this a valid sync Key?
         $keycheck = ORM::factory('private_gateway')->where('private_gateway_key', $private_gateway_key)->find(1);
         if ($keycheck->loaded == TRUE) {
             sms::add($message_from, $message_description);
         }
     }
 }
开发者ID:kamaulynder,项目名称:private_gateway,代码行数:26,代码来源:private_gateway.php

示例3: sendSms

 /**
  * @param string $smsGatewayName
  */
 public static function sendSms($information = array())
 {
     $smsGatewayName = self::getSmsGateway();
     $option = self::getSmsGatewayOption($smsGatewayName);
     self::includeSmsGatewayClass($smsGatewayName);
     return sms::sendSms($information, $option);
 }
开发者ID:osw17,项目名称:oledrion,代码行数:10,代码来源:oledrion_sms.php

示例4: send

 /**
  * Send The SMS Message Using Default Provider
  * @param to mixed	The destination address.
  * @param from mixed  The source/sender address
  * @param text mixed  The text content of the message
  *
  * @return mixed/bool (returns TRUE if sent FALSE or other text for fail)
  */
 public static function send($to = NULL, $from = NULL, $message = NULL)
 {
     if (!$to or !$message) {
         return "Missing Recipients and/or Message";
     }
     // 1. Do we have an SMS Provider?
     $provider = Kohana::config("settings.sms_provider");
     if ($provider) {
         // 2. Does the plugin exist, and if so, is it active?
         $plugin = ORM::factory("plugin")->where("plugin_name", $provider)->where("plugin_active", 1)->find();
         if ($plugin->loaded) {
             // Plugin exists and is active
             // 3. Does this plugin have the SMS Library in place?
             $class = ucfirst($provider) . '_SMS';
             $path = sms::find_provider($provider);
             if ($path) {
                 // File Exists
                 $sender = new $class();
                 // 4. Does the send method exist in this class?
                 if (method_exists($sender, 'send')) {
                     $response = $sender->send($to, $from, $message);
                     return $response;
                 }
             }
         }
     }
     return "No SMS Sending Provider In System";
 }
开发者ID:kjgarza,项目名称:ushahidi,代码行数:36,代码来源:sms.php

示例5: index

 function index()
 {
     $secret = "";
     if (isset($this->request['secret'])) {
         $secret = $this->request['secret'];
     }
     if (isset($this->request['from'])) {
         $message_from = $this->request['from'];
         // Remove non-numeric characters from string
         $message_from = preg_replace("#[^0-9]#", "", $message_from);
     }
     if (isset($this->request['message'])) {
         $message_description = $this->request['message'];
     }
     if (!empty($message_from) and !empty($message_description)) {
         $secret_match = TRUE;
         // Is this a valid Secret?
         $smssync = ORM::factory('smssync')->find(1);
         if ($smssync->loaded) {
             $smssync_secret = $smssync->secret;
             if ($smssync_secret and $secret != $smssync_secret) {
                 // A Secret has been set and they don't match
                 $secret_match = FALSE;
             }
         } else {
             // Can't load table
             $secret_match = FALSE;
         }
         if ($secret_match) {
             sms::add($message_from, $message_description);
         }
     }
 }
开发者ID:kh411d,项目名称:Ushahidi_Web,代码行数:33,代码来源:smssync.php

示例6: index

 function index()
 {
     $xmlstr = file_get_contents('php://input');
     $messagein = new SimpleXMLElement($xmlstr);
     $message_from = $messagein->From;
     $message_to = $messagein->To;
     $message_txt = $messagein->MessageText;
     sms::add($message_from, "{$message_txt}");
 }
开发者ID:rabbit09,项目名称:Taarifa_Web,代码行数:9,代码来源:esendex.php

示例7: index

	function index()
	{
		$secret = "";		
		if (isset($this->request['secret']))
		{
			$secret = $this->request['secret'];
		}
		
		if (isset($this->request['from']))
		{
			$message_from = $this->request['from'];
			// Remove non-numeric characters from string
			$message_from = preg_replace("#[^0-9]#", "", $message_from);
		}
		
		if (isset($this->request['message']))
		{
			$message_description = $this->request['message'];
		}
		
		if ( ! empty($message_from) AND ! empty($message_description))
		{
			$secret_match = TRUE;
			
			// Is this a valid Secret?
			$smssync = ORM::factory('smssync_settings')
				->find(1);
			
			if ($smssync->loaded)
			{
				$smssync_secret = $smssync->smssync_secret;
				if ($smssync_secret AND $secret != $smssync_secret)
				{ // A Secret has been set and they don't match
					$secret_match = FALSE;
				}
			}
			else
			{ // Can't load table
				$secret_match = FALSE;
			}
			
			if ($secret_match)
			{
				sms::add($message_from, $message_description);
				echo json_encode(array("payload" => array("success" => "true")));
			}
			else
			{
				echo json_encode(array("payload" => array("success" => "false")));
			}
		}
		else
		{
			echo json_encode(array("payload" => array("success" => "false")));
		}
	}
开发者ID:nurous,项目名称:bushfireconnect,代码行数:56,代码来源:smssync.php

示例8: SendCode

 public function SendCode()
 {
     $tel = I('tel');
     if (preg_match("/1[3458]{1}\\d{9}\$/", $tel)) {
         import('Vendor.Sms.sms');
         $sms = new \sms();
         $mobile_code = phone_random(0, 9);
         $content = "您的验证码是:" . $mobile_code . "。请不要把验证码泄露给其他人。";
         $result = $sms->sendTo($tel, $content);
         $date = array('tel' => $tel, 'authcode' => $mobile_code, 'create_time' => date("Y-m-d H:i:s"));
         if (2 == $result['code']) {
             M('t_authcode')->add($date);
             $this->ajaxReturn("1");
         } else {
             $this->ajaxReturn($result);
         }
     } else {
         $this->ajaxReturn('手机号码不正确');
     }
 }
开发者ID:elliott-hs,项目名称:ld,代码行数:20,代码来源:IntegralController.class.php

示例9: __construct

 function __construct()
 {
     global $prefix;
     $db_connection = new dbConnection();
     $this->link = $db_connection->connect();
     ini_set("soap.wsdl_cache_enabled", "0");
     self::$sms_client = new SoapClient('http://87.107.121.54/post/Send.asmx?wsdl', array('encoding' => 'UTF-8'));
     $this->parameters['username'] = "";
     $this->parameters['password'] = "";
     $this->parameters['from'] = "";
     return $this->link;
 }
开发者ID:amirmasoud,项目名称:sms,代码行数:12,代码来源:class.sms.php

示例10: _receive

 private function _receive()
 {
     $secret = "";
     $success = "false";
     //Sometimes user send blank SMSs or GSM operators will
     //send promotional SMSs with no phone number, so this way
     //these messages will always end up on the backend and not float around
     //on the phones forever.
     $message_description = Kohana::lang("ui_main.empty");
     $message_from = "00000000";
     $non_numeric_source = false;
     if (isset($this->request['secret'])) {
         $secret = $this->request['secret'];
     }
     if (isset($this->request['from']) && strlen($this->request['from']) > 0) {
         $message_from = $this->request['from'];
         $original_from = $message_from;
         $message_from = preg_replace("#[^0-9]#", "", $message_from);
         if (strlen($message_from) == 0) {
             $message_from = "00000000";
             $non_numeric_source = true;
         }
     }
     if (isset($this->request['message']) && strlen($this->request['message']) > 0) {
         $message_description = $this->request['message'];
     }
     if ($non_numeric_source) {
         $message_description = '<div style="color:red;">' . Kohana::lang("ui_main.message_non_numeric_source") . " \"" . $original_from . "\" </div>" . $message_description;
     }
     if (!empty($message_from) and !empty($message_description)) {
         $secret_match = TRUE;
         // Is this a valid Secret?
         $smssync = ORM::factory('smssync_settings')->find(1);
         if ($smssync->loaded) {
             $smssync_secret = $smssync->smssync_secret;
             if ($smssync_secret and $secret != $smssync_secret) {
                 // A Secret has been set and they don't match
                 $secret_match = FALSE;
             }
         } else {
             // No Secret Set
             $secret_match = TRUE;
         }
         if ($secret_match) {
             sms::add($message_from, $message_description);
             $success = "true";
         }
     }
     echo json_encode(array("payload" => array("success" => $success)));
 }
开发者ID:kjgarza,项目名称:ushahidi,代码行数:50,代码来源:smssync.php

示例11: _send_mobile_alert

 public static function _send_mobile_alert($post)
 {
     // For Mobile Alerts, Confirmation Code
     $alert_mobile = $post->alert_mobile;
     $alert_lon = $post->alert_lon;
     $alert_lat = $post->alert_lat;
     $alert_radius = $post->alert_radius;
     // Should be 6 distinct characters
     $alert_code = text::random('distinct', 8);
     $settings = ORM::factory('settings', 1);
     if (!$settings->loaded) {
         return FALSE;
     }
     // Get SMS Numbers
     if (!empty($settings->sms_no3)) {
         $sms_from = $settings->sms_no3;
     } elseif (!empty($settings->sms_no2)) {
         $sms_from = $settings->sms_no2;
     } elseif (!empty($settings->sms_no1)) {
         $sms_from = $settings->sms_no1;
     } else {
         $sms_from = "000";
         // User needs to set up an SMS number
     }
     $message = Kohana::lang('ui_admin.confirmation_code') . $alert_code . '.' . Kohana::lang('ui_admin.not_case_sensitive');
     if (sms::send($alert_mobile, $sms_from, $message) === true) {
         $alert = ORM::factory('alert');
         $alert->alert_type = self::MOBILE_ALERT;
         $alert->alert_recipient = $alert_mobile;
         $alert->alert_code = $alert_code;
         $alert->alert_lon = $alert_lon;
         $alert->alert_lat = $alert_lat;
         $alert->alert_radius = $alert_radius;
         if (isset($_SESSION['auth_user'])) {
             $alert->user_id = $_SESSION['auth_user']->id;
         }
         $alert->save();
         self::_add_categories($alert, $post);
         return TRUE;
     }
     return FALSE;
 }
开发者ID:rabbit09,项目名称:Taarifa_Web,代码行数:42,代码来源:alert.php

示例12: inbound

 /**
  * Processes incoming messages
  */
 public function inbound()
 {
     // Get the received data
     $data = array_merge($_GET, $_POST);
     // Verify the API key and incoming messageId parameters
     if (!empty($data['key']) and !empty($data['messageId']) and Nexmo_Model::is_valid_api_key($data['key'], 'inbound_message_key')) {
         // Extract fields from the submitted data
         $log_data = array('message_id' => $data['messageId'], 'message_type' => 1, 'message_sender' => $data['msisdn']);
         // Initialize model for updating the internal nexmo message log
         $log_entry = new Nexmo_Message_Log_Model();
         if ($log_entry->validate($log_data)) {
             // Success, save
             $log_entry->save();
         }
         //  Add entry to the main messages list
         sms::add($data['msisdn'], $data['text']);
     } else {
         Kohana::log('error', Kohana::lang('nexmo.invalid_url_auth_key'));
     }
 }
开发者ID:uws-eresearch,项目名称:invisiblecity-ushahidi,代码行数:23,代码来源:nexmo.php

示例13: index

 function index()
 {
     if (isset($_GET['key'])) {
         $frontlinesms_key = $_GET['key'];
     }
     if (isset($_GET['s'])) {
         $message_from = $_GET['s'];
         // Remove non-numeric characters from string
         $message_from = preg_replace("#[^0-9]#", "", $message_from);
     }
     if (isset($_GET['m'])) {
         $message_description = $_GET['m'];
     }
     if (!empty($frontlinesms_key) and !empty($message_from) and !empty($message_description)) {
         // Is this a valid FrontlineSMS Key?
         $keycheck = ORM::factory('frontlinesms')->where('frontlinesms_key', $frontlinesms_key)->find(1);
         if ($keycheck->loaded == TRUE) {
             sms::add($message_from, $message_description);
         }
     }
 }
开发者ID:kjgarza,项目名称:ushahidi,代码行数:21,代码来源:frontlinesms.php

示例14: index

 /**
  * Clickatell 2 way callback handler
  * @param string $key (Unique key that prevents unauthorized access)
  * @return void
  */
 function index($key = NULL)
 {
     if (isset($this->request['from'])) {
         $message_from = $this->request['from'];
         // Remove non-numeric characters from string
         $message_from = preg_replace("#[^0-9]#", "", $message_from);
     }
     if (isset($this->request['to'])) {
         $message_to = $this->request['to'];
         // Remove non-numeric characters from string
         $message_to = preg_replace("#[^0-9]#", "", $message_to);
     }
     if (isset($this->request['text'])) {
         $message_description = $this->request['text'];
     }
     if (!empty($message_from) and !empty($message_description)) {
         // Is this a valid Clickatell Key?
         $keycheck = ORM::factory('clickatell')->where('clickatell_key', $key)->find(1);
         if ($keycheck->loaded == TRUE) {
             sms::add($message_from, $message_description, $message_to);
         }
     }
 }
开发者ID:Dirichi,项目名称:Ushahidi_Web,代码行数:28,代码来源:clickatell.php

示例15: sendsms

 function sendsms()
 {
     $type = $_POST['type'];
     $amt = $_POST['amt'];
     $msg = $_POST['msg'];
     $when = $_POST['when'];
     // get numbers
     if ($type == "thai") {
         $query = $this->db->query('SELECT `id`,`name`,`number` FROM `contact_numbers` WHERE `status` = "1" AND `sent` != "1" LIMIT ' . $amt . '');
     }
     $contacts = $query->result();
     include "/home/www/xxxxxx.com/htdocs/js/sms/sms.class.php";
     $result_message = 'SMS RESULTS<br />';
     //print_r($contacts);
     foreach ($contacts as $c) {
         $username = 'xxxxxx';
         $password = '528051';
         //$username = 'thaibulksms';
         //$password = 'thisispassword';
         $ph = str_replace('+66', '0', $c->number);
         $msisdn = $ph;
         $message = str_replace('**NAME**', $c->name == "" ? '' : $c->name, $msg);
         $message = str_replace('**Name**', $c->name == "" ? '' : $c->name, $message);
         $message = str_replace('**name**', $c->name == "" ? '' : $c->name, $message);
         $sender = 'xxxxxx';
         //$sender = 'THAIBULKSMS';
         $ScheduledDelivery = $when;
         $force = 'standard';
         $result = sms::send_sms($username, $password, $msisdn, $message, $sender, $ScheduledDelivery, $force);
         $result_message .= 'Id: ' . $c->id . ' name: ' . $c->name . ' number: ' . $ph . ' result:' . $result . '<br /><br />';
         // update number
         $query = $this->db->query('UPDATE `contact_numbers` SET `sent` = 1 WHERE `id` = "' . $c->id . '"');
     }
     echo $result_message;
     exit;
 }
开发者ID:Nkelliny,项目名称:MobileDatingApp,代码行数:36,代码来源:ajax.php


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