Anouar Kacem
Anouar Kacem

Reputation: 645

Catch Http POST Requests from WooCommerce /WebHooks

I have a Woocommerce website and a testwebsite.com/test.php to catch the request from the webhook.

I would like to display the json data sent by the webhook on the test website.

Thank you in advance.

Upvotes: 1

Views: 1290

Answers (1)

Anouar Kacem
Anouar Kacem

Reputation: 645

Thanks to anyone who passed by, I found the solution here How to read data sent by webhooks? for anyone who is looking for it

$webhookContent = "";

$webhook = fopen('php://input' , 'rb');
while (!feof($webhook)) {
    $webhookContent .= fread($webhook, 4096);
}
fclose($webhook);
mail('[email protected]', 'test - hook', $webhookContent);

Upvotes: 2

Related Questions