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?

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top