I have a php api which is supposed to return responses with status codes. But returns only a 200 response code. This works when tested locally with Xampp but not a on live deployment server. On the deployment server i have tried :
- header(':',true,$code);
- http_response_code(404);
- header("Status: 404 Not Found");
- header('X-PHP-Response-Code: '.$code, true, $code);
Based on previous answers on stack overflow
public function echoResponse($code, $response){
header(':',true,$code);
echo json_encode($response);
exit();
}
I keep getting a response code of 200.