forked from prawnsalad/Nexmo-PHP-lib
-
Notifications
You must be signed in to change notification settings - Fork 1
/
README
70 lines (39 loc) · 1.63 KB
/
README
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
Sending SMS via the Nexmo SMS gateway.
Quick Examples
--------------
1) Sending an SMS
$sms = new NexmoMessage('account_key', 'account_secret');
$sms->sendText( '+447234567890', 'MyApp', 'Hello world!' );
2) Recieving SMS
$sms = new NexmoMessage('account_key', 'account_secret');
if ($sms->inboundText()) {
$sms->reply('You said: ' . $sms->text);
}
3) Recieving a message receipt
$receipt = new NexmoReceipt();
if ($receipt->exists()) {
switch ($receipt->status) {
case $receipt::STATUS_DELIVERED:
// The message was delivered to the handset!
break;
case $receipt::STATUS_FAILED:
case $receipt::STATUS_EXPIRED:
// The message failed to be delivered
break;
}
}
4) List purchased numbers on your account
$account = new NexmoAccount('account_key', 'account_secret');
$numbers = $account->numbersList();
Most Frequent Issues
--------------------
Sending a message returns false.
This is usually due to your webserver unable to send a request to
Nexmo. Make sure the following are met:
1) Either CURL is enabled for your PHP installation or the PHP
option 'allow_url_fopen' is set to 1 (default).
2) You have no firewalls blocking access to rest.nexmo.com/sms/json
on port 443.
Your message appears to have been sent but you do not recieve it.
Run the example.php file included. This will show any errors that
are returned from Nexmo.