-
Notifications
You must be signed in to change notification settings - Fork 1
/
example.php
26 lines (23 loc) · 1.03 KB
/
example.php
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
<?php
// +----------------------------------------------------------------------
// | 融云服务端SDK-PHP
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2018 LeeHom1988 All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( https://github.com/leehom1988/rongcloud-sdk-php/blob/1.x/LICENSE )
// +----------------------------------------------------------------------
// | Author: LeeHom1988 <lh411937409@gmail.com>
// +----------------------------------------------------------------------
require 'vendor/autoload.php';
use LeeHom\RongCloud\RongClient;
use LeeHom\RongCloud\Exception\RongCloudException;
use GuzzleHttp\Exception\GuzzleException;
$client = new RongClient('xxxxxxxxxx', 'xxxxxxxxxx');
try {
$r = $client->Message()->publishPrivate('123', '456', 'RC:TxtMsg', '{"content":"Hello 456"}');
echo $r;
} catch (RongCloudException $e) {
echo $e->getMessage();
} catch (GuzzleException $e) {
echo $e->getMessage();
}