I'm trying to find any way to create a proxy for Handle Server Sent Events from Facebook API (https://streaming-graph.facebook.com)
Because of CORS policy, I can't run my script localy so i'm trying to find any way to creat a proxy for that in PHP.
I tried many things but nothing work like I want. I would like to create a text/event-stream returning what i'm having from Facebook SSE.
<?php
// Set file mime type event-stream
header('Content-Type: text/event-stream');
header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate');
header("Access-Control-Allow-Origin: *");
$mustQuit = false;
// Server Sent events LINK
$handle = fopen(...url..., "r");
while (!$mustQuit && connection_status() == CONNECTION_NORMAL) {
echo stream_get_contents($handle);
flush();
// Wait 2 seconds for the next message / event
//sleep(1);
}
Nothing work ; it's only infinitly loading and sending nothing.