The concept of polling is very simple: send a request for new events (specifically, Create, Retrieve, and Delete events which signal changes in data) at a predetermined frequency and wait for the endpoint to respond. If the endpoint doesn’t respond, there are no new events to share.
Similar to polling, webhooks provide your application a way of consuming new event data from an endpoint. However, instead of sending repeated requests for new events, you provide the endpoint with a URL, usually within the endpoint UI, which your application monitors. Whenever a new event occurs within the endpoint app, it posts the event data to your specified URL, updating your application in real-time.
WEBHOOKS VS POLLING
Polling is a bad practice instead use webhooks or socket to get realtime data.
Here is an example of webhooks with php https://www.jotform.com/help/248-Webhook-PHP-Script-Examples