Jump to content

flush and ob_flush does not work when access the wesbite from remote host


Recommended Posts

Hi Evryone,

 

We have developed website which has a trigger a progress when performed an action on it,

we have used flush and ob_flush to regularly display the updated progress bar on the webpage.

 

It works fine when i access the website the same work, but when accessed the website from a remote host or which is in other network, the progress is not is displayed, its only getting displayed when it reached 100%

 

Could you please help to resolve the problem...

 

Thanks,

Sagar

<style>

,.progress_wrapper {width:400px;border:2px groove #ccc;position:absolute;top:280px;left:40%;margin-left:-100px;}

.progress {height:20px;background-color:green;}

</style>

 

<body>

    <?

     

        $width = 0;            //      the starting width

        $width_per_iteration = 400 / $nooftests;

 

      while ($currexeccnt <= $nooftests ){

                $width = $width_per_iteration * $currexeccnt; ?>

                echo '<div class="progress_wrapper">

                      <div class="progress" style="width:' . $width . 'px;"></div>

                      </div>';

 

            <?  ob_flush();

                flush();

} ?>

</body>

 

 

This is code the variables nooftests and currexeccnt will retrieved by perfroming some action on the server ..... so evrytime currexeccnt increases the progress bar  width increases......

 

 

Hopefully i can get a solution now..........

 

Thanks,

Sagar

Either your web server is buffering the output or you perhaps have a proxy server that is buffering the output. You would need to disable or satisfy all the buffering involved. If this for a general purpose application, you must also satisfy the minimum-block-length requirement of the different browsers.

 

Short answer: Web servers simply are not designed to operate this way. You should be using AJAX and have the client make periodic http requests to the web server to get the current status.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.