2
votes

I have set Webhook notification on Shopify platform when a new order is placed. I send the data to the URL of a PHP app I am currently working on and I want to print the incoming data in real-time on my browser. It is the first time I am working with Webhooks so any advice will be helpful. Thank you!

2
You need to print data only for testing webhook data or this will be a funtionality of your PHP application ?Bilal Akbar
@BilalAkbar For testing, at first. The functionality of my app will (hopefully) be that the moment I get the data of the webhook, I will process them and post them to a controller for the use of another app.Vicky Fi

2 Answers

0
votes

if you still need help with this: on the file you have set your webhook on use the following code to catch any incoming posts, you can print them or trigger them into your terminal.

$json = file_get_contents('php://input');
$data = json_decode($json,1);

i hope this helps you! Good day!

0
votes

Consider using Request Bin, Webhook Site or Ngrok

All these tools allow you to generate a unique end point and see webhooks recieved in real time. However there are several benefits of using Ngrok opposed to online tools. It runs locally and allows you to forward data to your local application. So Ngrok will allow you to see webhooks data on local web page and you can also send the same data to your local PHP application simultaneously.

Ngrok Documentation