本文整理汇总了PHP中SMS::send方法的典型用法代码示例。如果您正苦于以下问题:PHP SMS::send方法的具体用法?PHP SMS::send怎么用?PHP SMS::send使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SMS
的用法示例。
在下文中一共展示了SMS::send方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send
public function send($mobile = 8402059135)
{
$this->generateOTP();
$this->_mobile = $mobile;
$this->_message = 'Your One Time Password for MIS/SIS login is ' . $this->_CODE . '. NIT Silchar 2015.';
// API call to send sms
$sms = new SMS();
if ($sms->send($this->_mobile, $this->_message)) {
return 1;
} else {
echo 'OTP problem please try again later!';
Session::delete('OTPCode');
die;
}
}
示例2: SMS
if (isset($_POST['bulk_send'])) {
try {
$sms = new SMS();
$sms->send_broadcast($_POST['message'], $_POST['bulk_send']);
echo "<img src='img/true.png' width='150' height='150' /><br/><br/>";
echo "<span style='font-size: 20px;'>" . _("BROADCAST MESSAGE IS BEING SENT!") . "</span><br/><br/><br/><br/>";
echo "<a href='send_sms.php'><button class='b1'>" . _("Go Back") . "</button></a>";
} catch (SMSException $e) {
echo "<img src='img/false.png' width='200' height='170' /><br/><br/>";
echo "<span style='font-size: 20px; color: red;'>" . _("ERROR SENDING MASS SMS!") . "<br/>" . $e->getMessage() . " </span><br/><br/><br/><br/>";
echo "<a href='send_sms.php'><button class='b1'>" . _("Go Back") . "</button></a>";
}
} else {
try {
$sms = new SMS();
$sms->send('10000', $_POST['number'], $_POST['message']);
echo "<img src='img/true.png' width='150' height='150' /><br/><br/>";
echo "<span style='font-size: 20px;'>" . _("MESSAGE SENT!") . "</span><br/><br/><br/><br/>";
echo "<a href='send_sms.php'><button class='b1'>" . _("Go Back") . "</button></a>";
} catch (SMSException $e) {
echo "<img src='img/false.png' width='200' height='170' /><br/><br/>";
echo "<span style='font-size: 20px; color: red;'>" . _("ERROR SENDING SMS!") . "<br/>" . $e->getMessage() . " </span><br/><br/><br/><br/>";
echo "<a href='send_sms.php'><button class='b1'>" . _("Go Back") . "</button></a>";
}
}
}
} else {
print_form(0, '');
}
?>
示例3: sendSms
function sendSms($mobile, $location, $name)
{
// get new voucher
$db = new Db();
// SELECT voucher FROM vouchers WHERE location_id='".$location."' AND mobileno='' LIMIT 1
$voucher = $db->select("SELECT voucher FROM vouchers WHERE location_id='" . $location . "' AND mobileno IS NULL ORDER BY voucher LIMIT 1");
if (!empty($voucher)) {
// UPDATE vouchers SET mobileno='".$mobile."', lastupdate = NOW() WHERE voucher=''
$update = $db->query("UPDATE vouchers SET mobileno='" . $mobile . "', name='" . $name . "', lastupdate = NOW() WHERE voucher='" . $voucher[0]["voucher"] . "'");
// send SMS
$config = parse_ini_file(INIPATH);
$sms = new SMS("https://konsoleh.your-server.de/");
$domain = $config["smsdomain"];
// e.g.: «my-domain.de» (without www!)
$password = $config["smspassword"];
// your FTP password (transmission is encrypted)
$country = "+49";
// country code (e.g. "+49" for Germany)
$text = "Your voucher code is:" . $voucher[0]["voucher"];
// the desired text (up to max. 160 characters)
$sms->send($domain, $password, $country, $mobile, $text);
// return true
return true;
} else {
return false;
}
}
示例4: send
public function send($msg)
{
SMS::send($this->phone, $msg);
}
示例5: function
Route::post('clients/{id}/projects', 'ProjectController@store');
Route::post('clients/{id}/invoices', 'InvoiceController@store');
Route::post('clients/{id}/quotes', 'QuoteController@store');
Route::post('projects/{id}/updates', 'ProjectUpdateController@store');
Route::post('projects/{id}/activity', 'ProjectActivityController@store');
Route::post('return', 'APIController@returnReuqest');
Route::get('test-email', 'APIController@testMailQueue');
});
Route::post('oauth/access_token', function () {
return Response::json(Authorizer::issueAccessToken());
});
Route::get('protected-resource', ['middleware' => 'oauth', function () {
return "ya in";
}]);
Route::get('sms/{number}/{message}', function ($number, $message) {
$message = SMS::send($number, $message);
if ($message) {
return $message->messageId;
} else {
return "broken";
}
});
Route::get('sms/{messageId}', function ($messageId) {
$message = SMS::getResponse($messageId);
if ($message) {
return $message;
} else {
return "broken";
}
});
Route::post('receive-github', 'APIController@receive_push');
示例6: json_encode
$sub->send($msg);
}
echo json_encode($stock);
break;
case 'stocks':
$stocks = Stock::findAll();
echo json_encode($stocks);
break;
case 'delete':
$company = Request::any('company');
$stock = Stock::find($company);
$stock->delete();
echo json_encode($stock);
break;
case 'subscribers':
$subscribers = Subscriber::findAll();
echo json_encode($subscribers);
break;
case 'send':
$msg = Request::any('message');
$recs = Subscriber::findAll();
foreach ($recs as $r) {
SMS::send($r->phone, $msg);
}
echo json_encode(["success" => true]);
break;
}
} catch (Exception $e) {
http_response_code(500);
echo $e->getMessage();
}
示例7: foreach
foreach ($smss as $sms) {
echo "Received Message From: {$sms->sender} at {$sms->time}:\n";
echo "{$sms->message}\n\n";
$sub = new Subscriber();
$sub->phone = $sms->sender;
$sub->save();
$msg = $sms->message;
switch (strtolower($msg)) {
case '_stop':
$reply = "You will no longer receive our stock updates. Thank you for using our service.";
$sub->delete();
echo "Subscriber deleted...\n";
break;
default:
$company = $msg;
$stock = Stock::find($company);
if (!$stock) {
$reply = "Dear Subscriber, the specified company '{$company}' was not found.";
} else {
$reply = "Stock Price for {$company}: {$stock->price}";
}
}
SMS::send($sms->sender, $reply);
echo "Sent Reply to {$sms->sender}:\n{$reply}\n";
SMS::delete($sms);
echo "Message deleted\n\n";
}
//wait for 5 seconds
echo "Sleeping...";
sleep(5);
}
示例8: testSend
public function testSend()
{
$mobile_code = $this->random(4, 1);
$content = "您的验证码是:" . $mobile_code . "。请不要把验证码泄露给其他人。";
$sender = new SMS($this->account, $this->password, $this->mobile, $content);
$sender->send();
}
示例9: importMetadata
/**
* Import metadata using a mapping
*
* @param RequestHTTP $po_request The current request
* @param string $ps_source A path to a file or directory of files to import
* @param string $ps_importer The code of the importer (mapping) to use
* @param string $ps_input_format The format of the source data
* @param array $pa_options
* progressCallback =
* reportCallback =
* sendMail =
* dryRun =
* importAllDatasets =
* log = log directory path
* logLevel = KLogger constant for minimum log level to record. Default is KLogger::INFO. Constants are, in descending order of shrillness:
* KLogger::EMERG = Emergency messages (system is unusable)
* KLogger::ALERT = Alert messages (action must be taken immediately)
* KLogger::CRIT = Critical conditions
* KLogger::ERR = Error conditions
* KLogger::WARN = Warnings
* KLogger::NOTICE = Notices (normal but significant conditions)
* KLogger::INFO = Informational messages
* KLogger::DEBUG = Debugging messages
*/
public static function importMetadata($po_request, $ps_source, $ps_importer, $ps_input_format, $pa_options = null)
{
$va_errors = $va_noticed = array();
$vn_start_time = time();
$o_config = Configuration::load();
if (!ca_data_importers::mappingExists($ps_importer)) {
$va_errors['general'] = array('idno' => "*", 'label' => "*", 'errors' => array(_t('Importer %1 does not exist', $ps_importer)), 'status' => 'ERROR');
return false;
}
$vs_log_dir = caGetOption('log', $pa_options, null);
$vs_log_level = caGetOption('logLevel', $pa_options, "INFO");
$vb_import_all_datasets = caGetOption('importAllDatasets', $pa_options, false);
$vb_dry_run = caGetOption('dryRun', $pa_options, false);
$vn_log_level = BatchProcessor::_logLevelStringToNumber($vs_log_level);
if (!isURL($ps_source) && is_dir($ps_source)) {
$va_sources = caGetDirectoryContentsAsList($ps_source, true, false, false, false);
} else {
$va_sources = array($ps_source);
}
$vn_file_num = 0;
foreach ($va_sources as $vs_source) {
$vn_file_num++;
if (!ca_data_importers::importDataFromSource($vs_source, $ps_importer, array('fileNumber' => $vn_file_num, 'numberOfFiles' => sizeof($va_sources), 'logDirectory' => $o_config->get('batch_metadata_import_log_directory'), 'request' => $po_request, 'format' => $ps_input_format, 'showCLIProgressBar' => false, 'useNcurses' => false, 'progressCallback' => isset($pa_options['progressCallback']) ? $pa_options['progressCallback'] : null, 'reportCallback' => isset($pa_options['reportCallback']) ? $pa_options['reportCallback'] : null, 'logDirectory' => $vs_log_dir, 'logLevel' => $vn_log_level, 'dryRun' => $vb_dry_run, 'importAllDatasets' => $vb_import_all_datasets))) {
$va_errors['general'][] = array('idno' => "*", 'label' => "*", 'errors' => array(_t("Could not import source %1", $ps_source)), 'status' => 'ERROR');
return false;
} else {
$va_notices['general'][] = array('idno' => "*", 'label' => "*", 'errors' => array(_t("Imported data from source %1", $ps_source)), 'status' => 'SUCCESS');
//return true;
}
}
$vn_elapsed_time = time() - $vn_start_time;
if (isset($pa_options['sendMail']) && $pa_options['sendMail']) {
if ($vs_email = trim($po_request->user->get('email'))) {
caSendMessageUsingView($po_request, array($vs_email => $po_request->user->get('fname') . ' ' . $po_request->user->get('lname')), __CA_ADMIN_EMAIL__, _t('[%1] Batch metadata import completed', $po_request->config->get('app_display_name')), 'batch_metadata_import_completed.tpl', array('notices' => $va_notices, 'errors' => $va_errors, 'numErrors' => sizeof($va_errors), 'numProcessed' => sizeof($va_notices), 'subjectNameSingular' => _t('row'), 'subjectNamePlural' => _t('rows'), 'startedOn' => caGetLocalizedDate($vn_start_time), 'completedOn' => caGetLocalizedDate(time()), 'elapsedTime' => caFormatInterval($vn_elapsed_time)));
}
}
if (isset($pa_options['sendSMS']) && $pa_options['sendSMS']) {
SMS::send($po_request->getUserID(), _t("[%1] Metadata import processing for begun at %2 is complete", $po_request->config->get('app_display_name'), caGetLocalizedDate($vn_start_time)));
}
return array('errors' => $va_errors, 'notices' => $va_notices, 'processing_time' => caFormatInterval($vn_elapsed_time));
}
示例10: implode
$required_contacts[] = $all_contacts[$c][$type];
}
$recipients = implode(',', $required_contacts);
//send out messages
if ($type == 'sms') {
$biller = $admin->getSmsBillStatus();
$balance = $biller['units_assigned'] - $biller['units_used'];
$num_of_recipients = count($required_contacts);
$cost = $num_of_recipients * $num_of_sms_pages;
if ($balance > $cost) {
$settings = $admin->getSettings();
$gateway = $settings['sms_api_gatewayURL']['value'];
$username = $settings['sms_api_gatewayUsername']['value'];
$password = $settings['sms_api_gatewayPassword']['value'];
$sms = new SMS($gateway, $username, $password, $sender_id, $message_body, $recipients);
if ($sms->send()) {
$units_used = $sms->get_unitsUsed();
$q2 = "update messenger_sms_biller set units_used=(units_used + " . $units_used . ") where user_id='" . $admin->getAdminID() . "'";
$q3 = "insert into messenger_log values(NULL,'" . $admin->getAdminID() . "','{$message_body}','{$recipients}'," . time() . ",1," . time() . "," . $units_used . ")";
$result2 = mysqli_query($link, $q2);
AdminUtility::logMySQLError($link);
$result3 = mysqli_query($link, $q3);
AdminUtility::logMySQLError($link);
}
$responce = $sms->get_responseText();
} else {
$responce = "You do not have enough balance at the moment.<br/>";
$responce .= "You need additional " . ($cost - $balance) . " units to complete this action.";
}
} elseif ($type == 'email') {
if (mail($recipients, 'Subject: ' . $subject, wordwrap($message, 70, '\\r\\n'), 'From: ' . $reply_to . '\\r\\n' . 'Reply-To: ' . $contact_email . '\\r\\n' . 'X-Mailer: PHP/' . phpversion())) {
示例11: importMetadata
/**
* @param array $pa_options
* progressCallback =
* reportCallback =
* sendMail =
* log = log directory path
* logLevel = KLogger loglevel. Default is "INFO"
*/
public static function importMetadata($po_request, $ps_source, $ps_importer, $ps_input_format, $pa_options = null)
{
$va_errors = $va_noticed = array();
$vn_start_time = time();
$o_config = Configuration::load();
if (!ca_data_importers::mappingExists($ps_importer)) {
$va_errors['general'] = array('idno' => "*", 'label' => "*", 'errors' => array(_t('Importer %1 does not exist', $ps_importer)), 'status' => 'ERROR');
return false;
}
$vs_log_dir = isset($pa_options['log']) ? $pa_options['log'] : null;
$vn_log_level = KLogger::INFO;
switch ($vs_log_level = isset($pa_options['logLevel']) ? $pa_options['logLevel'] : "INFO") {
case 'DEBUG':
$vn_log_level = KLogger::DEBUG;
break;
case 'NOTICE':
$vn_log_level = KLogger::NOTICE;
break;
case 'WARN':
$vn_log_level = KLogger::WARN;
break;
case 'ERR':
$vn_log_level = KLogger::ERR;
break;
case 'CRIT':
$vn_log_level = KLogger::CRIT;
break;
case 'ALERT':
$vn_log_level = KLogger::ALERT;
break;
default:
case 'INFO':
$vn_log_level = KLogger::INFO;
break;
}
if (!ca_data_importers::importDataFromSource($ps_source, $ps_importer, array('logDirectory' => $o_config->get('batch_metadata_import_log_directory'), 'request' => $po_request, 'format' => $ps_input_format, 'showCLIProgressBar' => false, 'useNcurses' => false, 'progressCallback' => isset($pa_options['progressCallback']) ? $pa_options['progressCallback'] : null, 'reportCallback' => isset($pa_options['reportCallback']) ? $pa_options['reportCallback'] : null, 'logDirectory' => $vs_log_dir, 'logLevel' => $vn_log_level))) {
$va_errors['general'] = array('idno' => "*", 'label' => "*", 'errors' => array(_t("Could not import source %1", $vs_data_source)), 'status' => 'ERROR');
return false;
} else {
$va_notices['general'] = array('idno' => "*", 'label' => "*", 'errors' => array(_t("Imported data from source %1", $vs_data_source)), 'status' => 'SUCCESS');
//return true;
}
$vn_elapsed_time = time() - $vn_start_time;
if (isset($pa_options['sendMail']) && $pa_options['sendMail']) {
if ($vs_email = trim($po_request->user->get('email'))) {
caSendMessageUsingView($po_request, array($vs_email => $po_request->user->get('fname') . ' ' . $po_request->user->get('lname')), __CA_ADMIN_EMAIL__, _t('[%1] Batch metadata import completed', $po_request->config->get('app_display_name')), 'batch_metadata_import_completed.tpl', array('notices' => $va_notices, 'errors' => $va_errors, 'numErrors' => sizeof($va_errors), 'numProcessed' => sizeof($va_notices), 'subjectNameSingular' => _t('row'), 'subjectNamePlural' => _t('rows'), 'startedOn' => $vs_started_on, 'completedOn' => caGetLocalizedDate(time()), 'elapsedTime' => caFormatInterval($vn_elapsed_time)));
}
}
if (isset($pa_options['sendSMS']) && $pa_options['sendSMS']) {
SMS::send($po_request->getUserID(), _t("[%1] Metadata import processing for begun at %2 is complete", $po_request->config->get('app_display_name'), $vs_started_on));
}
return array('errors' => $va_errors, 'notices' => $va_notices, 'processing_time' => caFormatInterval($vn_elapsed_time));
}
示例12: send_verify_phone
function send_verify_phone($to_phone, $title)
{
global $_G;
$key = random(6, 1);
$_SESSION['verify_phone'] = $to_phone . '_' . $key;
$_SESSION['verify_phone_len'] = intval($_SESSION['verify_phone_len']) + 1;
if ($_SESSION['verify_phone_len'] > 15) {
return array('status' => 'error', 'msg' => '频繁发送多条短信,请等2小时后再重新发送');
}
if (!$title) {
$title = '您的验证码为 ' . $key . ' ,切勿告诉他人【' . $_G[setting][title] . "】";
}
//开始发短信
if (!class_exists('SMS')) {
include_once ROOT_PATH . 'web/lib/message/sms.class.php';
}
//即时发送
$sms = new SMS();
$rt = $sms->send($to_phone, $title);
if ($rt === true) {
return array('status' => 'success', 'msg' => '', 'data' => $key);
} else {
return array('status' => 'error', 'msg' => $rt);
}
}
示例13: processRegoSubmission
function processRegoSubmission()
{
// $out = new OUTPUTj(0,"","Registration currently not available");
// echo $out->toJSON();
// return false;
$json = $_POST["json"];
if ($json || $_POST["reference"]) {
if ($json != "") {
//create new object with json data
$rego = new Registration($json);
//check if json data exists
if ($rego->exists()) {
$out = new OUTPUTj(0, "", "This registration information already exists!");
echo $out->toJSON();
return false;
}
//json to objects
$rego->parseJSON();
//make sure the json converted is valid
if ($rego->isValid() == false) {
$out = new OUTPUTj(0, "", $rego->errMsg);
echo $out->toJSON();
return false;
}
//$out = new OUTPUTj(0,"","Registration is temporarily unavailable!");
//echo $out->toJSON();
//return false;
//$rego->toString();
if ($rego->commitDB()) {
$ref = $rego->Reference;
//send sms
try {
//we try this as we dont want to show error if sms fails
//we still want to show the registration information
//check for aussie mobile prefix
if (substr($rego->Phone, 0, 5) == "+6104" || substr($rego->Phone, 0, 4) == "+614") {
$sms = new SMS();
if ($sms->access_token) {
$messageId = $sms->send($rego->Phone, 'Hi ' . $rego->Firstname . ', your ref: ' . $ref . '. View your rego @ http://tinyurl.com/h4glqrk?ref=' . $ref . '\\n\\nDaiHoi Melbourne2016 Team.');
if ($messageId) {
$rego->updateSMSMessageId($rego->Reference, $messageId);
}
}
}
} catch (Exception $e) {
//should log error in db
}
//we send email
try {
//we try this as we dont want to show error if email fails
//we still want to show the registration information
$show_viet_section = 0;
if (startsWith($rego->Phone, "+84") || startsWith($rego->Phone, "84") || endsWith($rego->Church, "Vietnam")) {
$show_viet_section = 1;
}
$message = $rego->getRego($ref);
$email = new Mailer();
$email->sendMail($rego->Email, 'DaiHoi 2016 Registration [' . $ref . '] for: ' . $rego->FullName(), $message, $show_viet_section);
} catch (Exception $e) {
//should log error in db
}
$out = new OUTPUTj(1, $ref, $rego->errMsg);
echo $out->toJSON();
} else {
$out = new OUTPUTj(0, "", $rego->errMsg);
echo $out->toJSON();
}
}
}
}
示例14: file_get_contents
<?php
require_once "SMS.php";
$sms_contents = file_get_contents("/tmp/smstemplate");
SMS::send("9585518355", $sms_contents);
示例15:
<?php
//подключение класса
require_once "sms.php";
//отправка смс
SMS::send('+3***********', 'Hello World');
?>