Skip to content

Instantly share code, notes, and snippets.

@paoga87
Last active February 24, 2017 02:45
Show Gist options
  • Save paoga87/47649d822cb7d2e1fe083441e77e2ed3 to your computer and use it in GitHub Desktop.
Save paoga87/47649d822cb7d2e1fe083441e77e2ed3 to your computer and use it in GitHub Desktop.
This is an example of how the endpoint file looked like. This was set to capture the data SendGrid's webhook was sending.
<?php
date_default_timezone_set('America/New_York');
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$myFile = "tmp/log.txt";
$fh = fopen($myFile, 'a+') or die("can't open file");
if ($fh){
$headers = apache_request_headers();
$postdata = file_get_contents("php://input");
foreach ($headers as $header => $value) {
fwrite($fh, print_r("$header: $value \n", true));
}
fwrite($fh, print_r($postdata, true));
fclose($fh);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment