Paolo
Paolo

Reputation: 400

SendGrid INTEGRATION TESTING TOOL Sending Empty Data

I'm new to SendGrid and I want to test and check what data the Event Notification sends. So I set the endpoint and click the Test Your Integration button.

The endpoint does get something but it's an empty array. Why is that?

My script is simple:

file_put_contents(dirname(__FILE__).'/jsondata.txt', print_r($_POST, 1), FILE_APPEND);
header('X-PHP-Response-Code: 200' , true, 200);

What am I doing wrong?

Help!

Thanks.

Upvotes: 1

Views: 279

Answers (1)

Paolo
Paolo

Reputation: 400

Okay found the answer.

Here's my updated code:

$data = file_get_contents("php://input");
$events = json_decode($data, true);
file_put_contents(dirname(__FILE__).'/jsondata.txt', print_r($events, 1), FILE_APPEND);
header('X-PHP-Response-Code: 200' , true, 200);

Upvotes: 1

Related Questions