-
-
Save joseadrian/7362728 to your computer and use it in GitHub Desktop.
This file contains 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 | |
define('VERIFY_TOKEN', 'yourappssecret'); | |
$method = $_SERVER['REQUEST_METHOD']; | |
if ($method == 'GET' && $_GET['hub_mode'] == 'subscribe' && $_GET['hub_verify_token'] == VERIFY_TOKEN) { | |
echo $_GET['hub_challenge']; | |
} else if ($method == 'POST') { | |
$updates = json_decode(file_get_contents("php://input"), true); | |
// Here you can do whatever you want with the JSON object that you receive from FaceBook. | |
// Before you decide what to do with the notification object you might aswell just check if | |
// you are actually getting one. You can do this by choosing to output the object to a textfile. | |
// It can be done by simply adding the following line: | |
// file_put_contents('/filepath/updates.txt',$updates, FILE_APPEND); | |
error_log('updates = ' . print_r($obj, true)); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment