Skip to content

Instantly share code, notes, and snippets.

@LiamChapman
Created February 21, 2014 09:50
Show Gist options
  • Select an option

  • Save LiamChapman/9131552 to your computer and use it in GitHub Desktop.

Select an option

Save LiamChapman/9131552 to your computer and use it in GitHub Desktop.
For reading app_data in the URL and other other things on Facebook
<?php
if (!function_exists('facebook_request')) {
function facebook_request () {
if (isset($_REQUEST['signed_request'])) {
if ($request = $_REQUEST['signed_request']) {
list($encoded_sig, $payload) = explode('.', $request, 2);
$decoded = base64_decode(strtr($encoded_sig, '-_', '+/'));
$data = base64_decode(strtr($payload, '-_', '+/'));
return json_decode($data, true);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment