-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathussd-webhook-events.php
More file actions
29 lines (23 loc) · 1.26 KB
/
ussd-webhook-events.php
File metadata and controls
29 lines (23 loc) · 1.26 KB
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
<?php
require_once('vendor/autoload.php');
use App\Bases\DB;
$pdo = new DB();
$db = $pdo->connectToDB();
$date = $_POST['date'];
$session_id = $_POST['sessionId'];
$service_code = $_POST['serviceCode'];
$network_code = $_POST['networkCode'];
$phone = $_POST['phoneNumber'];
$status = $_POST['status'];
$cost = $_POST['cost'];
$duration_milliseconds = $_POST['durationMillis'];
$input = $_POST['input'];
$last_app_response = $_POST['lastAppResponse'];
$error_message = $_POST['errorMessage'];
saveWebhookNotification($db, $date, $session_id, $service_code, $network_code, $phone, $status, $cost, $duration_milliseconds, $input, $last_app_response, $error_message);
function saveWebhookNotification($pdo, $date, $session_id, $service_code, $network_code, $phone, $status, $cost, $duration_milliseconds, $input, $last_app_response, $error_message) {
$stmt = $pdo->prepare("INSERT INTO webhook_notifications (date, session_id, service_code, network_code, phone, status, cost, duration_milliseconds, `input`, last_response, error_message)
VALUES (?,?,?,?,?,?,?,?,?,?,?)");
$stmt->execute([$date, $session_id, $service_code, $network_code, $phone, $status, $cost, $duration_milliseconds, $input, $last_app_response, $error_message]);
$stmt = null;
}