Closed h2u closed 8 years ago
Try to log file_get_contents("php://input")
without json_decode
Can you get some samples of your code with this problem?
P. S. GET or DELETE methods doesn't have body, and php://input
will be empty
<?php
if (!empty($_REQUEST['hub_mode']) && $_REQUEST['hub_mode'] == 'subscribe' && $_REQUEST['hub_verify_token'] == "<mytoken>") {
echo $_REQUEST['hub_challenge'];
} else {
$data = json_decode(file_get_contents("php://input"), true);
file_put_contents('bot_'.time().'.txt', print_r($data, true));
}
?>
The first part of code needs only to verify webhook. I think Facebook sends PUT method to webhook. I can't access ftp now, so I will try to write "php://input" to file later today and give you answer, @ya-kostik.
Please, check web server logs. php://input not getting through if request has an redirection. Maybe your webserver has an redirect from www. to url without www or maybe without slash on wnd of address to without slash.
Thank you guys. @ipimax you were right. I had url like https://domain.com/bot, and it has redirect to /bot/ (added slash).
So I changed url and it's ok now.
Just ran into a similar issue, worth mentioning that the app won't get any data if it's not public, not even for admins.
@manix You need to pass app review include business verification (if needed)
this is a separate topic for discussion)
Not sure that it's your package problem but i have nothing in $data variable (json_decode(file_get_contents("php://input"), true)). Can't find any soultion about this.
Im writing data to file like (file_putcontents('bot'.time().'.txt', print_r($data, true));) this and file is empty.
Can you please help me?