Skip to content

Instantly share code, notes, and snippets.

@anthonycvella
Created February 1, 2013 02:43
Show Gist options
  • Save anthonycvella/4688771 to your computer and use it in GitHub Desktop.
Save anthonycvella/4688771 to your computer and use it in GitHub Desktop.
// Send HTTP Response Method
function sendResponse($status, $body = '')
{
$status_header = 'HTTP/1.1 ' . $status;
header($status_header);
header('Content-type: application/json');
echo $body;
}
// Calling the HTTP Response Method with parameters
sendResponse(200, json_encode(array(
'username' => $username,
'token' => $token
)));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment