python - How to read SSE data in PHP
Need the code in PHP for a similar implementation that you can find below link in Python.
One of the 3rd Party server sends the data in SSE (Server Sent Events), that I need to be captured and save to my database in PHP.
I tried with HTML5 to read the stream and with AJAX call the data can be pushed to a PHP file in turn to DB. But the drawback is we have to keep browser on always.
I tried with
fopen the streaming URL and
fread to fetch data. But the looping and waiting for event data is where I struck. Need help in PHP code to read the data, so that I can set a cron job of the PHP code to push to DB as and when data receives.
Here is a Python code, I need a similar code in PHP Reading SSE data in python