Created
March 31, 2017 23:56
-
-
Save lav45/ee538cd33db1eb0c220572a8123ef870 to your computer and use it in GitHub Desktop.
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 | |
$secret = 'secret key'; | |
list($hashAlgo, $signature) = explode('=', $_SERVER['HTTP_X_HUB_SIGNATURE']); | |
$payload = $HTTP_RAW_POST_DATA ?: file_get_contents('php://input'); | |
$compute = hash_hmac($hashAlgo, $payload, $secret); | |
$valid = hash_equals($compute, $signature); | |
if ($valid === false) { | |
exit('Incorrect data'); | |
} | |
// ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment