Help pulling data from payload and saving to database

Help pulling data from payload and saving to database

Good morning and thank you in advance for your help.

I have created a webhook that calls a .php page on my server whenever a new account is created. I want this .php page to pull the customers name, email and customer id from the payload and save it in my MySQL user database on my server.

How do I format this to receive this information? My current code, which doesn't work, is below, Hopefully this gives you an idea of what I am trying to do.

$name = $_POST['data']['subscription']['customer']['display_name'];
$customerid = $_POST['data']['subscription']['customer']['customer_id'];
$email = $_POST['data']['subscription']['customer']['email'];

Any help would be greatly appreciated.