Created
February 21, 2014 09:50
-
-
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
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 (!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