I'm trying to stream a video file from a remote server to a client, and I want to get the size of the content transferred while the client plays the file, is it possible somehow?
$file = 'https://example.com/?rud27pxppu45zk.mp4';
$head = array_change_key_case(get_headers($file, TRUE));
$size = $head['content-length']; // because filesize() won't work remotely
header('Content-Type: video/mp4');
header('Accept-Ranges: bytes');
header('Content-Disposition: inline');
header('Content-Length:'.$size);
readfile($file);
exit;