Last active
December 27, 2019 20:05
-
-
Save theiasapidecv/baeab215c8fc02daed438f5da0bde53b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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