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


PHP SoapClient::Auth方法代码示例

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


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

示例1: send

 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;
 }
开发者ID:cosmolady,项目名称:cosmolady.github.io,代码行数:33,代码来源:TurboSMS.php

示例2: send

 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>";
     }
 }
开发者ID:xtarantulz,项目名称:TurboSMS,代码行数:30,代码来源:sms.php

示例3: connect

 /**
  * @return SoapClient
  * @throws CHttpException
  */
 protected function connect()
 {
     if ($this->client) {
         return $this->client;
     }
     $client = new SoapClient($this->wsdl);
     if (!$this->config['login'] || !$this->config['password']) {
         throw new CHttpException(500, 'Enter login and password from Turbosms');
     }
     $result = $client->Auth(['login' => $this->config['login'], 'password' => $this->config['password']]);
     if ($result->AuthResult . '' != 'Вы успешно авторизировались') {
         throw new CHttpException(500, $result->AuthResult);
     }
     $this->client = $client;
     return $this->client;
 }
开发者ID:buildshop,项目名称:bs-common,代码行数:20,代码来源:Turbosms.php

示例4: AGI

set_time_limit(30);
$callerid = $argv[1];
require_once 'phpagi.php';
require_once 'db_work.php';
$agi = new AGI();
//$phone = preg_replace("/[^0-9]/", "", $callerid['data']);
$phone = substr($callerid, -9);
$agi->exec('NoOP', $phone);
if (strlen($phone) == 9) {
    $agi->exec('NoOP', '11111' . $phone);
    $op = values("SELECT dstchannel FROM `cdr` WHERE src LIKE '%" . $phone . "' AND dcontext = 'phones_incom' AND dstchannel!='' ORDER BY calldate DESC LIMIT 1");
    $agi->exec('NoOP', '22222-Count' . count($op));
    if (count($op) < 1) {
        //$agi->exec('NoOP','3333'.$op[0]["dstchannel"]);
        //header ('Content-type: text/html; charset=utf-8');
        $client = new SoapClient('http://turbosms.in.ua/api/wsdl.html');
        //$agi->exec('NoOP','444');
        $auth = array('login' => 'oyv1979', 'password' => 'Av1979');
        //$agi->exec('NoOP','555');
        $result = $client->Auth($auth);
        //$agi->exec('NoOP','666');
        $text = 'Krainashin.com - любые шины и диски. Бесплатная линия 0(800)300-305';
        $sms = array('sender' => 'KRAINASHIN', 'destination' => '+380' . $phone, 'text' => $text);
        $agi->exec('NoOP', '777');
        //$result = $client->SendSMS ($sms);
        $agi->exec('NoOP', $result);
    }
}
?>

开发者ID:kipkaev55,项目名称:asterisk,代码行数:29,代码来源:soap_sms.php


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