#13 - Processing JSON POST request in PHP
Data: 2018-06-16 12:00 - PHP
Sample code on how to process a JSON POST request in PHP
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$values = @json_decode(file_get_contents('php://input'), true);
if ($values !== null) {
// do whatever you want with your $values
} else {
http_response_code(400);
die(json_encode(['error' => 'malformed json input']));
}
}