note 89177 modified in features.connection-handling by danbrown

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
A simple but useful packaging of arr1's suggestion for continuing processing after telling the the browser that output is finished.

I always redirect when a request requires some processing (so we don't do it twice on refresh) which makes things easy...

<?php
 function redirect_and_continue($sURL)
 {
  header( "Location: ".$sURL ) ;
  ob_end_clean(); //arr1s code
  header("Connection: close");
  ignore_user_abort();
  ob_start();
  header("Content-Length: 0");
  ob_end_flush();
  flush(); // end arr1s code
  session_write_close(); // as pointed out by Anonymous
 }
?>

Of course this won't work if the output has started - but the a simple redirect wouldn't work anyway.

UPDATE: To get this to work on IIS 7 you need to switch off IIS output buffering by adding responseBufferLimit="0" to the relevant handler in your web.config

Thanks for the tip arr1

--was--
A simple but useful packaging of arr1's suggestion for continuing processing after telling the the browser that output is finished. 

I always redirect when a request requires some processing (so we don't do it twice on refresh) which makes things easy...

<?php
  function redirect_and_continue($sURL)
  {
    header( "Location: ".$sURL ) ;
    ob_end_clean(); //arr1s code
    header("Connection: close");
    ignore_user_abort();
    ob_start();
    header("Content-Length: 0");
    ob_end_flush(); 
    flush(); // end arr1s code
    session_write_close(); // as pointed out by Anonymous
  }
?>

Of course this wont work if the output has started - but the a simple redirect wouldn't work anyway.

Thanks for the tip arr1

http://php.net/manual/en/features.connection-handling.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.