How to read data sent by webhooks?

I have the latest woocommerce plugin, and I have to set a webhook to one of my URL. But I am not able to read it in my $_REQUEST and nor in $input = file_get_contents("php://input");.

Related posts

1 comment

  1. $webhookContent = "";
    
    $webhook = fopen('php://input' , 'rb');
    while (!feof($webhook)) {
        $webhookContent .= fread($webhook, 4096);
    }
    fclose($webhook);
    mail('mail@yourdomain.com', 'test - hook', $webhookContent);
    

    This is all it took. It will send all the body to your email

Comments are closed.