• Resolved drea21

    (@drea21)


    Hello,

    Amazing plugin, thank you for writing it. I was able to get a full implementation done to receive data and am working on a second one.

    Specifically for Facebook Webhooks, I am trying to do the verify step. I am able to respond to the Facebook request, but it looks like $return_args is adding additional backslashes to escape the string.

    Here is a code sample:

    
    		if ($_GET['hub_challenge']) {	
    			$return_args = $_GET['hub_challenge'];
    			error_log(print_r($return_args, true));
    			return $return_args;
    		}
    

    I can see in the error_log that the value I expect is correct for $return_args, but I think some processing happens after that because Facebook is showing me this:

    The URL couldn’t be validated. Response does not match challenge, expected value=”271718342″, received=”\”271718342\””

    In my logs those \” are not there. Is there some processing that might be causing this?

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Ironikus

    (@ironikus)

    Hey @drea21 – thank you a lot for your message!
    This happens because you send over the data as a string instead of a JSON (return_args is usually an array).

    To make it work, simply turn your variable from a string to an integer:
    $return_args = intval( $_GET['hub_challenge'] );

    Hope this helps!

    Plugin Author Ironikus

    (@ironikus)

    Hey @drea21 – I hope the solution we provided helped you. Since we haven’t heard back in a while, I’m going to close this task.
    If you should have any further questions, feel free to let us know at any time. 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘$return_args possibly adding escape slashes’ is closed to new replies.