-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.php
More file actions
40 lines (31 loc) · 769 Bytes
/
Copy pathexample.php
File metadata and controls
40 lines (31 loc) · 769 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
namespace Example;
require 'vendor/autoload.php';
use Fruitware\ProstorSms\Client;
use Fruitware\ProstorSms\Exception\BadSmsStatusException;
use Fruitware\ProstorSms\Model\Sms;
use GuzzleHttp\Client as GuzzleClient;
//set basic access authentication
$options = [
'defaults' => [
'auth' => ['user', 'password'],
],
];
$smsGate = new Client(new GuzzleClient($options));
var_dump('version', $smsGate->version());
var_dump('balance', $smsGate->balance());
// простой вариант
$sms = new Sms();
$sms
->setId(uniqid())
->setPhone('+71234567890')
->setText('тест sms')
->setSender('Test sender')
;
try {
$smsGate->send($sms);
}
catch (BadSmsStatusException $ex) {
var_dump($ex);
}
var_dump('sms', $sms);