Skip to content

Instantly share code, notes, and snippets.

@ivoryworks
Created April 11, 2014 00:13
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 ivoryworks/10433705 to your computer and use it in GitHub Desktop.
Save ivoryworks/10433705 to your computer and use it in GitHub Desktop.
AttPush
<?php
@set_time_limit(0);
@ignore_user_abort(false);
@ini_set( 'zlib.output_compression', 'off' );
header('Cache-Control: no-cache');
header('Pragma: no-cache');
header("Content-Type: multipart/x-mixed-replace;boundary=END",true);
print "--END\n";
$att = "A\n";
textPush($att);
for ($i = 0; $i < 99; $i++) {
$att .= 'ta';
if ((strlen($att) % 40) == 0) {
$att .= " \n";
}
textPush($att);
}
$att .= "\nWhat's up!";
textPush($att, true);
// text/plain push
function textPush($str, $end=false) {
print "Content-Type: text/plain\n";
print sprintf("Content-strlength: %d\n\n", strlen($str));
echo($str);
print ($end) ? "\n\n--END--\n" : "\n\n--END\n";
usleep(100000);
ob_flush();
flush();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment