本文整理汇总了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;
}
示例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>";
}
}
示例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;
}
示例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);
}
}
?>