How best listen to incoming webhooks in PHP?

Advertisements

So I have a PHP script that listens for incoming webhooks. But: where do I put it, so that it permanently runs in the background and listens for those webhooks? I have done some PHP coding before, but never websites.

I admit this is a nooby question, but I seriously don’t know and would appreciate any help.

>Solution :

A "webhook" is just a fancy term for some code which makes a HTTP request to a particular URL (usually in response to itself receiving an incoming HTTP request from somewhere, or at the time when some other internal event occurs within the application where the webhook is defined). Basically it’s a conceptual technique which allows a degree of asynchronous communication between web applications in a controlled way.

So a PHP program which listens for webhook requests is really no different to any other PHP program which is accessible via a webserver – both are simply executed in a response to a HTTP request being received by the webserver. Whether that request comes from a browser, a "webhook" script, or any other kind of computer program is largely irrelevant.

Your webserver is already running in the background and doing the listening. Therefore you can just deploy your script in the normal way, to somewhere your webserver can make use of it to respond to requests to the URL you’ve provided to the webhook.

Leave a ReplyCancel reply