forked from Jeapie/push-message-for-php5
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.php
More file actions
32 lines (26 loc) · 674 Bytes
/
example.php
File metadata and controls
32 lines (26 loc) · 674 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
<?php
/**
* @author Jeapie <jeapiecompany@gmail.com>
* @version 0.1
* */
require 'PushMessage.php';
PushMessage::init()
->setUser('user token goes here')
->setToken('app token goes here')
->setTitle('Hello')
->setMessage('World')
->setDevice('you device name')
->setPriority(0)
->send();
if (!PushMessage::init()->getResult()) {
print_r(PushMessage::init()->getErrors());
} else {
echo 'the message was sent';
}
// after the first initialization, you can immediately send messages
PushMessage::init()->send();
if (!PushMessage::init()->getResult()) {
print_r(PushMessage::init()->getErrors());
} else {
echo 'the message was sent';
}