Created
April 11, 2014 00:13
-
-
Save ivoryworks/10433705 to your computer and use it in GitHub Desktop.
AttPush
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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