Skip to content

Instantly share code, notes, and snippets.

@theiasapidecv
Last active December 27, 2019 20:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theiasapidecv/baeab215c8fc02daed438f5da0bde53b to your computer and use it in GitHub Desktop.
Save theiasapidecv/baeab215c8fc02daed438f5da0bde53b to your computer and use it in GitHub Desktop.
<?php
$postBody = file_get_contents('php://input');
$message = json_decode($postBody, true);
if ($message) {
$type = $message['Type'];
if (strcmp($type, 'SubscriptionConfirmation') == 0) {
file_get_contents($message['SubscribeURL']);
} elseif (strcmp($type, 'Notification') == 0) {
$subject = $message['Subject'];
if (strcmp($subject, 'New Study') == 0) {
echo $message['Message'];
// ...
} elseif (strcmp($subject, 'New Interpretation') == 0) {
echo $message['Message'];
// ...
} else {
http_response_code(400);
}
} else {
http_response_code(400);
}
} else {
http_response_code(400);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment