PHP - Error receiving data by $ _POST from WebHook

0

I am trying to receive data from the WebHook of CuentaDigital.com, but when it comes to doing the test that your server does, I always get error 403 . The information they give is scarce or null, the only thing they answered was

  

"Its operation is normalized like all webhooks, it does not send   variables so if you expect an http post with variables not   you will receive nothing what you are looking for is    $csv=file_get_contents('php://input'); "

Now, I put the file_get_contents('php://input') but nevertheless I still give error 403 , therefore I can not receive any information

    
asked by Ignacio Copparoni 19.06.2018 в 16:50
source

1 answer

0

Problem solved, the problem was the Hosting blocking an HTTP POST, I tried the Script on a VPS and it worked normally. This is the Script

<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    // fetch RAW input
    $json = file_get_contents('php://input');

    // decode json
    $object = json_enc($json);

    file_put_contents('callback.test.txt', print_r($object, true));
}
?>
    
answered by 19.06.2018 в 18:16