I'm trying to create a webhook to send JSON encoded data to a users webhook receiver.
This is how I send the data:
$url = 'https://www.example.com/user-webhook-receiver.php';
$data = array('title' => 'Hello',
'message' => 'World',
'url' => 'http://example.com/#check');
$content = json_encode($data);
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER,
array("Content-type: application/json"));
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $content);
$json_response = curl_exec($curl);
How can the user access the data I sent him? I tried this, but there is no content in it:
$data = json_decode($_POST);
How to access the data?