Welcome Guest, Not a member yet? Register   Sign In
Facebook Webhooks API
#1

Not sure whether you guys can help me out here.

I have worked on CI for other project and it is working perfectly fine.

However, when I am trying to use CI for one of my Facebook Webhooks projects, it seems that CI is filtering the data posted from Facebook but if i create a standalone PHP file using the same code (except the GET/POST function which using CI $this->input), it is working fine.

When I enable CI debug mode, this is the debug log available:
DEBUG - 2017-05-12 02:18:51 --> Global POST, GET and COOKIE data sanitized

I have checked the HTTP log as well, HTTP 403 is returned for all Facebook post to CI.

I would really like to use CI for all my project. Hope someone out there will have some idea
Reply
#2

Is CSRF protection enabled?
Reply
#3

Does not seems to work too as I disable it.
Reply
#4

Could you provide an example of what you're trying to achieve, and how you tried doing it in CI?
Reply
#5

Thanks antony.

Ok, when performing Facebook verification, FB send a GET request to CI and it is working fine for the verification part.

Quote:if (isset($_GET['hub_verify_token'])) {
   if ($_GET['hub_verify_token'] === 'lgC5XeJwYCJgaMfdTzit') {
       echo $_GET['hub_challenge'];
       return;
   } else {
       echo 'Invalid Verify Token';
       return;
   }
}
However, when FB do a postback for data , it is posting via POST which we need to extract it using this code. This code is inside the controller.
$input = json_decode(file_get_contents('php://input'), true);

However, CI response 403. No matter what I do.
Reply
#6

(This post was last modified: 05-14-2017, 02:55 AM by InsiteFX.)

Do you by any chance have xss_clean turned on?

I checked the input core and it does nothing to the input stream unless you have xss_clean turned on.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB