<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST'){
$data = file_get_contents("php://input");
$decode = json_decode($data);
// expecting valid json
if (json_last_error() !== JSON_ERROR_NONE) {
die(header('HTTP/1.0 415 Unsupported Media Type'));
}
$file = 'events.json';
/**
* Do something with object, structure will be like:
* $object->accountId
* $object->details->items[0]['contactName']
*/
// dump to file so you can see
file_put_contents($file, print_r($decode->event, true) . PHP_EOL, FILE_APPEND);
}
?>