Skip to content

Commit 8119bf6

Browse files
committed
Receive SMS Delivery Receipt
1 parent bc5fe07 commit 8119bf6

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

sms/receive-delivery-receipt.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
require_once __DIR__ . '/../config.php';
3+
4+
require_once __DIR__ . '/../vendor/autoload.php';
5+
6+
$request = array_merge($_GET, $_POST);
7+
8+
// Check that this is a delivery receipt.
9+
if (!isset($request['messageId']) || !isset($request['status'])) {
10+
error_log('This is not a delivery receipt');
11+
return;
12+
}
13+
14+
//Check if your message has been delivered correctly.
15+
if ($request['status'] === 'delivered') {
16+
error_log("Your message to {$request['msisdn']} (message id {$request['messageId']}) was delivered.");
17+
error_log("The cost was {$request['price']}.");
18+
}
19+
else if ($request['status'] === 'accepted') {
20+
error_log("Your message to {$request['msisdn']} (message id {$request['messageId']}) was accepted by the carrier.");
21+
error_log("The cost was {$request['price']}.");
22+
}
23+
else {
24+
error_log("Your message to {$request['msisdn']} has a status of: {$request['status']}.");
25+
error_log("Check err-code {$request['err-code']} against the documentation.");
26+
}

0 commit comments

Comments
 (0)