Facebook webhook for pages [closed]

浪尽此生 提交于 2019-12-04 07:00:19

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/35999627/facebook-webhook-for-pages

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!