PhP - I can not get the flush or ob_flush command to work

Problems with the Windows version of XAMPP, questions, comments, and anything related.

PhP - I can not get the flush or ob_flush command to work

Postby doctorriee » 09. March 2008 23:41

I can not get the flush or ob_flush command to work. I want to flush the buffer and keep the thread alive. I want to do html streaming.
I am rather new at programming so it may be a stupid mistake.

I am running Microsoft XP profesional with service pack 2
I literally tried every example on both the apache friends website and php.net website and could not get anything to work. Some of the attempts are attached below .
I probably do not have something checked.

Thank you for reading my post

alan

<?php

// print_r($_GET);
$id1 = $_GET["id"];
$imgId1 = $_GET["imgId"];
$state1 = $_GET["state"];
$state1 = ($state1+1)%2;
echo "commands= 1 id= $id1 gif_name= $imgId1 gif_state= $state1";


flush();


usleep(2000000);
echo "commands= 1 id= $id1 gif_name= $imgId1 gif_state= $state1";
ob_flush();
flush(); // needed ob_flush
;

usleep(2000000);
echo "commands= 1 id= $id1 gif_name= $imgId1 gif_state= $state1";
ob_flush();
flush(); // needed ob_flush
;


?>

////////////////////////////////////
<?php

// print_r($_GET);
$id1 = $_GET["id"];
$imgId1 = $_GET["imgId"];
$state1 = $_GET["state"];
$state1 = ($state1+1)%2;
echo "commands= 1 id= $id1 gif_name= $imgId1 gif_state= $state1";

ob_end_flush();
flush();


usleep(2000000);
echo "commands= 1 id= $id1 gif_name= $imgId1 gif_state= $state1";
ob_flush();
flush(); // needed ob_flush
;

usleep(2000000);
echo "commands= 1 id= $id1 gif_name= $imgId1 gif_state= $state1";
ob_flush();
flush(); // needed ob_flush
;


?>


/////////////////////////////////////////
<?php

// print_r($_GET);
$id1 = $_GET["id"];
$imgId1 = $_GET["imgId"];
$state1 = $_GET["state"];
$state1 = ($state1+1)%2;
echo "commands= 1 id= $id1 gif_name= $imgId1 gif_state= $state1";
flush();
ob_flush();
flush();
ob_flush();
flush();
ob_flush();

usleep(2000000);
echo "commands= 1 id= $id1 gif_name= $imgId1 gif_state= $state1";
ob_flush();
flush(); // needed ob_flush
;

usleep(2000000);
echo "commands= 1 id= $id1 gif_name= $imgId1 gif_state= $state1";
ob_flush();
flush(); // needed ob_flush
;


?>
////////////////////////////////////////////////////
<?php
while (ob_get_level()) {
ob_end_flush();
}
// start output buffering
if (ob_get_length() === false) {
ob_start();
}
// print_r($_GET);
$id1 = $_GET["id"];
$imgId1 = $_GET["imgId"];
$state1 = $_GET["state"];
$state1 = ($state1+1)%2;
echo "commands= 1 id= $id1 gif_name= $imgId1 gif_state= $state1";

ob_flush();
flush();


usleep(2000000);
echo "commands= 1 id= $id1 gif_name= $imgId1 gif_state= $state1";
ob_flush();
flush(); // needed ob_flush
;

usleep(2000000);
echo "commands= 1 id= $id1 gif_name= $imgId1 gif_state= $state1";
ob_flush();
flush(); // needed ob_flush
;


?>
////////////////////////////////////////////////////
<?php
ob_start() ;
ob_end_flush();
// print_r($_GET);
$id1 = $_GET["id"];
$imgId1 = $_GET["imgId"];
$state1 = $_GET["state"];
$state1 = ($state1+1)%2;
echo "commands= 1 id= $id1 gif_name= $imgId1 gif_state= $state1";
ob_flush();
flush(); // needed ob_flush

usleep(2000000);
echo "commands= 1 id= $id1 gif_name= $imgId1 gif_state= $state1";
ob_flush();
flush(); // needed ob_flush
;

usleep(2000000);
echo "commands= 1 id= $id1 gif_name= $imgId1 gif_state= $state1";
ob_flush();
flush(); // needed ob_flush
;

usleep(2000000);
echo "commands= 1 id= $id1 gif_name= $imgId1 gif_state= $state1";
ob_flush();
flush(); // needed ob_flush
;
?>
doctorriee
 
Posts: 4
Joined: 09. March 2008 23:27

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 113 guests