Skip to content

Instantly share code, notes, and snippets.

@ramsey
Created August 13, 2015 14:34
Show Gist options
  • Save ramsey/aa76c1656ca9fa6eeab7 to your computer and use it in GitHub Desktop.
Save ramsey/aa76c1656ca9fa6eeab7 to your computer and use it in GitHub Desktop.
Return a response to the client before processing anything
<?php
// Return our response as quickly as possible.
header('Connection: close');
ob_start();
header('HTTP/1.0 204 No Content');
ob_end_flush();
flush();
// This immediately sends our response to the client; I hope you didn't have any other headers to set.
// Now, you can do all your other processing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment