Skip to content

Instantly share code, notes, and snippets.

@tristanbailey
Forked from ramsey/respond-quickly.php
Last active August 29, 2015 14:27
Show Gist options
  • Save tristanbailey/c11018e748f908e05111 to your computer and use it in GitHub Desktop.
Save tristanbailey/c11018e748f908e05111 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 200 OK');
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.
@tristanbailey
Copy link
Author

sample code to send a response as a api endpoint and then follow with a request in return in later code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment