Webhook not getting data

Hello Team,

I am configured mautic web hook and selected event as new contact . But i am not getting any data to provided webhook url, when new contect is created.

Here is the sample code :-

Code:
$file = 'people.txt'; // Open the file to get existing content $current = file_get_contents($file); // Append a new person to the file foreach ($_POST as $key => $value) { $current .= "Field ".htmlspecialchars($key)." is ".htmlspecialchars($value)."
"; } // Write the contents back to the file file_put_contents($file, $current);

Is i am doing anything wrong ?

Hello Team,
I am configured mautic web hook and selected event as new contact . But i am not getting any data to provided webhook url, when new contect is created.
Here is the sample code :-

 $file = 'people.txt';
// Open the file to get existing content
$current = file_get_contents($file);
// Append a new person to the file
foreach ($_POST as $key => $value)
{
 	$current .= "Field ".htmlspecialchars($key)." is ".htmlspecialchars($value)."<br>";
}
// Write the contents back to the file
file_put_contents($file, $current);

Is i am doing anything wrong ?

Wrong way to receive data.

You should be doing:
$postdata = file_get_contents(“php://input”);
file_put_contents($file, $postdata);