Skip to content

Instantly share code, notes, and snippets.

@marcguyer
Last active December 11, 2015 07:19
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 marcguyer/4565766 to your computer and use it in GitHub Desktop.
Save marcguyer/4565766 to your computer and use it in GitHub Desktop.
Raw PHP example for validating CheddarGetter webhook.
<?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