0

I set up a php server on a web host using this script I found from a website

<?php

define('VERIFY_TOKEN', 'DEVICETOKEN');
$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);

file_put_contents('/filepath/updates.txt',$updates, FILE_APPEND);

error_log('updates = ' . print_r($obj, true));
}

?>

I used the realtime update panel on facebook to subscribe to a simple user email request as a test, I get this error everytime.

Response does not match challenge, expected value = '1098150855',
received='1098150855<!-- www.s...'

How do I solve this problem?

CloudyMarble
  • 36,908
  • 70
  • 97
  • 130
yannc2021
  • 681
  • 5
  • 7

1 Answers1

0

The only thing that should be outputted on your callback url is the hub.challenge parameter. Remove the comment after the 0855... and any other output and it should work.

Neil
  • 1,066
  • 6
  • 10