Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- define('VERIFY_TOKEN', 'yourownsecretstring');
- $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') {
- //Connect To Database
- $hostname='Your host address';
- $username='Your username';
- $password='Your password';
- $dbname='Your database name';
- mysql_connect($hostname,$username, $password) OR DIE ('Unable to connect to database! Please try again later.');
- mysql_select_db($dbname) or die(mysql_error());
- $post_body = file_get_contents("php://input");
- $object = json_decode($post_body, true);
- foreach($object->entry as $update)
- {
- // For each entry in notification, insert a row of information into the table "FaceBook"
- $changed_fields = $update->changed_fields[0];
- $result = mysql_query("INSERT INTO FaceBook (uid, id, time, changed_fields) VALUES('$update->uid', '$update->id', '$update->time', '$changed_fields')")
- or die(mysql_error());
- }
- mysql_close();
- }
- ?>
Add Comment
Please, Sign In to add comment