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 withfopen the streaming URL andfread 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

People are also looking for solutions to the problem: drupal 7 - Access $block inside Block body field that has PHP evaluator enabled


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.