Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.