[Solved] Webhook and php

I am struggling with getting the info I want from a webhook with php

If I use in my php file
$fullrequest = file_get_contents(‘php://input’);
I get back the contents
event=CellVendEvent&data=2000&published_at=2016-05-12T16%3A23%3A44.254Z&coreid=XXXXXXXXXXXXXXXXXXXXX

Now if I want to strip out just the data portion, i.e. get 2000 I can’t get it to work.

I have tried
$data = $_POST[“data”];
and tried
$data = htmlentities($_POST[“data”]);
and tried
$json = $_POST[];
$decoded = json_decode($json, true);
$data = $decoded->data;

just not winning.

All I want to do is get the value out of the POST.

Cheers
Michael

$_POST[“data”]; should work if it is indeed a POST variable.

Could you post your webhook configuration ?

This is what I have used successfully:

$event                     = $_POST['event'];
$data                      = $_POST['data'];
$published_at              = $_POST['published_at'];
$coreid                    = $_POST['coreid'];


1 Like

Thanks for your help.

It was the use of double quotations which was causing the problem. Changed to single quotes and everything works.

Funny how you get blinded - glad we have this community to help