Skip to content

Commit bc5fe07

Browse files
committed
receive SMS
1 parent 5bd0d51 commit bc5fe07

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

sms/receive-sms.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
require_once __DIR__ . '/../config.php';
3+
4+
require_once __DIR__ . '/../vendor/autoload.php';
5+
6+
$basic = new \Nexmo\Client\Credentials\Basic(NEXMO_API_KEY, NEXMO_API_SECRET);
7+
$client = new \Nexmo\Client(new \Nexmo\Client\Credentials\Container($basic));
8+
9+
$inbound = \Nexmo\Message\InboundMessage::createFromGlobals();
10+
11+
if($inbound->isValid()){
12+
error_log($inbound->getBody());
13+
14+
$client->message()->send($inbound->createReply('Thanks for the SMS!'));
15+
} else {
16+
error_log('invalid message');
17+
}

0 commit comments

Comments
 (0)