Skip to content

Instantly share code, notes, and snippets.

@wizardishungry
Created January 22, 2009 19:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wizardishungry/50681 to your computer and use it in GitHub Desktop.
Save wizardishungry/50681 to your computer and use it in GitHub Desktop.
Server push solution
<?php
@apache_setenv('no-gzip', 1);
@ini_set('zlib.output_compression', 0);
@ini_set('implicit_flush', 1);
function hardFlush() {
flush();
ob_flush();
}
header('Content-type: multipart/x-mixed-replace;boundary="rn9012"');
for($i=0;$i<=10;$i++)
{
print "--rn9012\n";
echo "Content-Type: text/html\n\n";
echo "<html>$i";
echo '<!--',str_repeat(' ',1024),'-->';
echo "</html>";
hardFlush();
sleep(1);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment