Last active
December 11, 2015 07:19
-
-
Save marcguyer/4565766 to your computer and use it in GitHub Desktop.
Raw PHP example for validating CheddarGetter webhook.
This file contains hidden or 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 | |
if (empty($_SERVER['HTTP_X_CG_SIGNATURE'])) { | |
//invalid | |
} | |
$rawBody = file_get_contents('php://input'); | |
$token = md5($rawBody); | |
// check signature | |
if ($_SERVER['HTTP_X_CG_SIGNATURE'] != hash_hmac('sha256',$token,$productKey)) { | |
//invalid | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment