Facebook的webhook页面 [英] Facebook webhook for pages
问题描述
问题是我无法获得任何我的行动后从Facebook的数据。我创建了页面和用户webhook,然后我创建了php脚本,将随时记录facebook尝试到达该页面。现在我可以看到Facebook正在调用该页面,但是我无法从该通话中获取任何数据。我已经打印了POST的内容,但它给了我1的价值。
此外,没有配置可以设置我需要跟踪的Facebook页面。我如何设置?
我已经打印了POST的内容,但它给我的价值1。
Facebook不会将数据作为正常POST请求发送,它直接发送JSON。因此PHP不会填充$ _POST - 您需要直接读取原始的响应正文,然后解码。
file_get_contents('php:/ / input')
,然后 json_decode
。
另外,没有配置,我可以设置哪个Facebook页面我需要跟踪。如何设置?
您需要将您的应用程序订阅页面以接收更新,请参阅 https://developers.facebook.com/docs/graph-api/reference/page/subscribed_apps
I have admin access on one page, I have created facebook app and created and verified webhook on my website.
The problem is that I can't get any data from facebook after my action. I created page and user webhook, then I created php script which will log any time facebook tries to reach that page. Now I can see facebook is calling that page, but I can't get any data from that call. I have printed content of POST but it is giving me value "1".
Also, there is no configuration with which I can set which facebook page I need to track. How can I set it?
I have printed content of POST but it is giving me value "1".
Facebook does not send the data as a "normal" POST request, it sends JSON directly. Therefor PHP will not populate $_POST – you need to read the raw response body directly, and then decode it.
file_get_contents('php://input')
, and then json_decode
.
Also, there is no configuration with which I can set which facebook page I need to track. How can I set it?
You need to subscribe your app to the page to receive updates, see https://developers.facebook.com/docs/graph-api/reference/page/subscribed_apps
这篇关于Facebook的webhook页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!