public function send($destination, $text) { $client = new SoapClient(self::URL); $sendResult = array('sent' => false, 'message' => ''); $result = $client->Auth(array('login' => self::LOGIN, 'password' => self::PASS)); var_dump($result); if ($result->AuthResult != 'Вы успешно авторизировались') { $sendResult['message'] = 'Не удалось авторизоваться'; return $sendResult; } $result = $client->GetCreditBalance(); if ($result->GetCreditBalanceResult <= 0) { $sendResult['message'] = 'Недостаточно средств для отправки'; return false; } $destination = $this->formatPhone($destination); if (!$destination) { $sendResult['message'] = 'Неверный формат номера получателя'; return $sendResult; } $sms = array('sender' => self::SENDER, 'destination' => $destination, 'text' => $text); //echo "try to send sms to ".$destination." from ".$sender." with message = ".$text; // Подпись отправителя может содержать английские буквы и цифры. Максимальная длина - 11 символов. // Номер указывается в полном формате, включая плюс и код страны $result = $client->SendSMS($sms); if ($result->SendSMSResult->ResultArray[0] != 'Сообщения успешно отправлены') { var_dump($result->SendSMSResult); $sendResult['message'] = $result->SendSMSResult->ResultArray[0]; return $sendResult; } $sendResult['sent'] = true; return $sendResult; }
public static function send($r, $m, $d = false) { try { $pdo = new PDO("mysql:host=94.249.146.189;dbname=users", SMS::$login, SMS::$pwd); $pdo->query("SET NAMES utf8;"); if ($d == false) { $pdo->query("INSERT INTO `{SMS::{$login}}` (`number`,`message`,`sign`) VALUES ('{$r}','{$m}','{SMS::{$sender}}')"); } else { $pdo->query("INSERT INTO `{SMS::{$login}}` (`number`,`message`,`sign`,`send_time`) VALUES ('{$r}','{$m}','{SMS::{$sender}}','{$d}')"); } } catch (Exception $e) { //дебаги от меня echo "<pre>"; print_r($e); echo "</pre>"; $client = new SoapClient('http://turbosms.in.ua/api/wsdl.html'); $auth = array('login' => SMS::$login, 'password' => SMS::$pwd); $res = $client->Auth($auth); //дебаги от меня echo "<pre>"; print_r($res); echo "</pre>"; $sms = array('sender' => SMS::$sender, 'destination' => $r, 'text' => $m); $res = $client->SendSMS($sms); //дебаги от меня echo "<pre>"; print_r($res); echo "</pre>"; } }
public function mensajeria($sender, $subject, $message, $receiver) { $client = new SoapClient($this->_url, $this->_option); $parametros = array("sender" => $sender, "subject" => $subject, "message" => $message, "receiver" => $receiver, "key" => $this->_key, "login" => $this->_login); $result = $client->SendSMS($parametros); //var_dump($result); return $result; }
public function SendSMS() { $client = new SoapClient($this->wsdl_link); $result = $client->SendSMS(array('userName' => $this->username, 'password' => $this->password, 'fromNumber' => $this->from, 'toNumbers' => $this->to, 'messageContent' => $this->msg, $this->isflash)); if ($result->SendSMSResult == 0) { $this->InsertToDB($this->from, $this->msg, $this->to); $this->Hook('wp_sms_send', $result); return true; } }
public function SendSMS() { $client = new SoapClient($this->wsdl_link); $result = $client->SendSMS(array('MobileNo' => $this->to, 'SMSText' => $this->msg, 'AcountID' => $this->password, 'LineNo' => $this->from)); if ($result) { $this->InsertToDB($this->from, $this->msg, $this->to); $this->Hook('wp_sms_send', $result); } return $result->Send_x0020_One_x0020_SMSResult; }
public function SendSMS() { // Check credit for the gateway if (!$this->GetCredit()) { return; } /** * Modify sender number * * @since 3.4 * @param string $this->from sender number. */ $this->from = apply_filters('wp_sms_from', $this->from); /** * Modify Receiver number * * @since 3.4 * @param array $this->to receiver number */ $this->to = apply_filters('wp_sms_to', $this->to); /** * Modify text message * * @since 3.4 * @param string $this->msg text message. */ $this->msg = apply_filters('wp_sms_msg', $this->msg); $client = new SoapClient($this->wsdl_link); $result = $client->SendSMS(array('MobileNo' => $this->to, 'SMSText' => $this->msg, 'AcountID' => $this->password, 'LineNo' => $this->from)); $result = $result->Send_x0020_One_x0020_SMSResult; if ($result) { $this->InsertToDB($this->from, $this->msg, $this->to); /** * Run hook after send sms. * * @since 2.4 * @param string $result result output. */ do_action('wp_sms_send', $result); } return $result; }
public function SendSMS() { // Check credit for the gateway if (!$this->GetCredit()) { return; } /** * Modify sender number * * @since 3.4 * @param string $this->from sender number. */ $this->from = apply_filters('wp_sms_from', $this->from); /** * Modify Receiver number * * @since 3.4 * @param array $this->to receiver number */ $this->to = apply_filters('wp_sms_to', $this->to); /** * Modify text message * * @since 3.4 * @param string $this->msg text message. */ $this->msg = apply_filters('wp_sms_msg', $this->msg); $client = new SoapClient($this->wsdl_link); $result = $client->SendSMS(array('userName' => $this->username, 'password' => $this->password, 'fromNumber' => $this->from, 'toNumbers' => $this->to, 'messageContent' => $this->msg, $this->isflash)); if ($result->SendSMSResult == 0) { $this->InsertToDB($this->from, $this->msg, $this->to); /** * Run hook after send sms. * * @since 2.4 * @param string $result result output. */ do_action('wp_sms_send', $result); return $result; } }
protected function run($data) { $mSmsSetting = new SmsSetting(); $setting = $mSmsSetting->getByAppid($data['appID']); if ($this->_alarm($setting)) { return 1999; } $defApiConfig = ['sn' => $this->name, 'password' => $this->pwd]; $apiConfig = json_decode($setting['service_config'], true); $contentPostfix = $setting && isset($setting['content_postfix']) ? $setting['content_postfix'] : ''; $apiConfig = $apiConfig && is_array($apiConfig) ? array_merge($defApiConfig, $apiConfig) : $defApiConfig; $cx = new \SoapClient($this->soapUrl); $sendContent = ['sn' => $apiConfig['sn'], 'password' => $apiConfig['password'], 'content' => $contentPostfix . $data['content'], 'mobile' => $data['mobile'], 'ext' => '', 'stime' => $this->stime, 'issign' => 'N', 'sign' => '']; try { $return = $cx->SendSMS($sendContent); $result = $return->SendSMSResult; } catch (\Exception $e) { throw new \Exception($e->getMessage(), 1301); } return $result; }
/** * @soap发短信 *免申模板 'content' => '您的账号123,密码是987,欢迎您注册i代言。【i代言】', */ public function SoapSend() { if (is_array($this->mobile)) { $phone = implode(',', $mobile); } else { $phone = $this->mobile; //检测 发送频率 if (!$this->checkRate($phone)) { return '发送频率太高'; } } $cx = new \SoapClient(Sms::CHUANGRUI_SOAPURL); //$cx = new \SoapClient("http://web.cr6868.com/asmx/webservice.asmx?wsdl"); $sendcontent = array('sn' => Sms::CHUANGRUI_NAME, 'password' => Sms::CHUANGRUI_PWD, 'content' => $this->content, 'mobile' => $phone, 'ext' => '', 'stime' => $this->stime, 'issign' => 'N', 'sign' => ''); $return = $cx->SendSMS($sendcontent); $result = $return->SendSMSResult; //写入日志 $smslog_model = new SmsLog(); $log = array('mobile' => $phone, 'status' => $result->code == 0 ? 0 : 1, 'errorcode' => $result->code, 'errorinfo' => '', 'sendmessage' => $this->content, 'from' => $this->from, 'client_info' => $this->client_info); $logreturn = $smslog_model->saveLog($log); return $log['status']; }
<?php set_time_limit(30); #require_once('phpagi.php'); #require_once('db_work.php'); #$agi = new AGI(); #$agi->answer(); #$callerid = $agi->get_variable("CALLERID(num)"); header('Content-type: text/html; charset=utf-8'); $client = new SoapClient('http://turbosms.in.ua/api/wsdl.html'); $auth = array('login' => 'oyv1979', 'password' => 'Av1979'); $result = $client->Auth($auth); echo $result->AuthResult . ''; $text = 'Спасибо за звонок! Krainashin - шины и диски. 098290-8000, 066362-8000'; #$text = iconv ('KOI8-U', 'utf-8', 'Спасибо за звонок! Krainashin - шины и д'); $sms = array('sender' => 'KRAINASHIN', 'destination' => '+380674587575', 'text' => $text); print_r($sms); $result = $client->SendSMS($sms); echo $result->SendSMSResult->ResultArray[0] . '';
<?php $sn = '15810101211'; $password = '******'; $mobile = '18601352378'; $content = '您的账号123,密码是789,欢迎您注册i代言。【i代言】'; $ext = ''; $stime = ''; $issign = ''; $sign = ''; try { $ws = 'http://web.cr6868.com/asmx/webservice.asmx?wsdl'; $soap = new SoapClient($ws); //var_dump($soap->SendSMS($sn, $password, $content, $mobile, $ext, $stime, $issign, $sign)); var_dump($soap->SendSMS($sn, $password, $content, $mobile, $ext)); } catch (Exception $e) { var_dump($e); }
/** * @soap发短信 *免申模板 'content' => '您的账号123,密码是987,欢迎您注册i代言。【i代言】', */ protected function SoapSend() { if (is_array($this->mobile)) { $phone = implode(',', $mobile); } else { $phone = $this->mobile; //检测 发送频率 if (!$this->checkRate($phone)) { return '发送频率太高'; } } $cx = new \SoapClient($this->soapUrl); //$cx = new \SoapClient("http://web.cr6868.com/asmx/webservice.asmx?wsdl"); $sendContent = ['sn' => $this->name, 'password' => $this->pwd, 'content' => $this->content, 'mobile' => $phone, 'ext' => '', 'stime' => $this->stime, 'issign' => 'N', 'sign' => '']; try { $return = $cx->SendSMS($sendContent); $result = $return->SendSMSResult; } catch (\Exception $e) { throw new \Exception($e->getMessage(), 1003); } //写入日志 $smslogModel = new SmsLog(); $log = ['mobile' => $phone, 'status' => $result->code == 0 ? 0 : 1, 'errorcode' => $result->code, 'errorinfo' => '', 'sendmessage' => $this->content, 'from' => $this->from, 'client_info' => $this->clientInfo]; $logreturn = $smslogModel->saveLog($log); return $result->code; }