continue processing php after sending http response

Yes. You can do this: ignore_user_abort(true);//not required set_time_limit(0); ob_start(); // do initial processing here echo $response; // send the response header(‘Connection: close’); header(‘Content-Length: ‘.ob_get_length()); ob_end_flush(); @ob_flush(); flush(); fastcgi_finish_request();//required for PHP-FPM (PHP > 5.3.3) // now the request is sent to the browser, but the script is still running // so, you can continue… die(); //a … Read more

java.lang.IllegalStateException: Cannot (forward | sendRedirect | create session) after response has been committed

A common misunderstanding among starters is that they think that the call of a forward(), sendRedirect(), or sendError() would magically exit and “jump” out of the method block, hereby ignoring the remnant of the code. For example: protected void doXxx() { if (someCondition) { sendRedirect(); } forward(); // This is STILL invoked when someCondition is … Read more