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


PHP sms::add方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: _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

示例6: 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

示例7: 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

示例8: 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

示例9: sms

 /**
  * Receive SMS's via FrontlineSMS or via Mobile Phone Native Apps
  *
  * @return string
  */
 public function sms()
 {
     $reponse = array();
     // Validate User
     // Should either be authenticated or have app_key
     $username = isset($this->request['username']) ? $this->request['username'] : "";
     $password = isset($this->request['password']) ? $this->request['password'] : "";
     $app_key = isset($this->request['key']) ? $this->request['key'] : "";
     if ($user_id = $this->_login($username, $password)) {
         // Process POST
         // setup and initialize form field names
         $form = array('message_from' => '', 'message_description' => '', 'message_date' => '');
         /**
          * Instantiate Validation,
          * use $post, so we don't overwrite $_POST fields with our
          * own things
          */
         $post = Validation::factory($_POST);
         //  Add some filters
         $post->pre_filter('trim', TRUE);
         /**
          * Add some rules, the input field, followed by a list of
          * checks, carried out in order.
          */
         $post->add_rules('message_from', 'required', 'numeric', 'length[6,20]');
         $post->add_rules('message_description', 'required', 'length[3,300]');
         $post->add_rules('message_date', 'date_mmddyyyy');
         // Test to see if things passed the rule checks
         if ($post->validate()) {
             sms::add($post->message_from, $post->message_description);
             // success!
             $reponse = array("payload" => array("domain" => $this->domain, "success" => "true"), "error" => $this->api_service->get_error_msg(0));
         } else {
             // Required parameters are missing or invalid
             $reponse = array("payload" => array("domain" => $this->domain, "success" => "false"), "error" => $this->api_service->get_error_msg(02));
         }
     } else {
         // Authentication Failed. Invalid User or App Key
         $reponse = array("payload" => array("domain" => $this->domain, "success" => "false"), "error" => $this->api_service->get_error_msg(05));
     }
     // Set the response data
     $this->response_data = $this->response_type == 'json' ? $this->array_as_json($reponse) : $this->array_as_xml($reponse, array());
 }
开发者ID:kjgarza,项目名称:ushahidi,代码行数:48,代码来源:MY_Private_Func_Api_Object.php


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