Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I debug a webhook POST?

Tags:

post

php

webhooks

A webhook is sending me a POST, and I want to do some debugging on it. Currently I'm looping over the array and then sending a mail() to myself instead of printing (because how could I see what's printed to the page?), but I'm betting there's a more efficient way.

Any suggestions?

like image 757
Zack Burt Avatar asked Sep 20 '10 08:09

Zack Burt


People also ask

How do I check my webhook response?

To view the request sent by Dynamic Content to the webhook URL, together with the response, click "View details". An example of the request sent to a webhook that accepts the content created webhook event is shown below. The request consists of headers and a body.

How do you get data from a webhook?

With webhooks, it's generally a three-step process: Get the webhook URL from the application you want to send data to. Use that URL in the webhook section of the application you want to receive data from. Choose the type of events you want the application to notify you about.

Why my webhook is not working?

Another common reason why your webhooks could not be working is that you're not fulfilling the total requirements for consuming them. I once had an experience where I was receiving the webhooks but the request body was empty. It turned out that my server had to parse the raw request stream.


2 Answers

https://requestbin.com/ lets you create a temporary URL that will show you all the HTTP request data sent to it.

like image 181
progrium Avatar answered Sep 20 '22 13:09

progrium


There are multiple options for debugging:

  1. Use a debugger with an IDE, like netbeans. This will run the application and figure out where things are going wrong.
  2. Use logfiles of your server, or generated by application exceptions
  3. Collect your debug information with a buffer and put it in a file in your public directory. Overwrite with every new request.
like image 38
user228395 Avatar answered Sep 20 '22 13:09

user228395