Reputation: 2885
I am calling my rest with CURL php and setting response header like:
header('Status',true,422);
and when printing status I get 422
.
but when I set header like:
header('Status',true,440);
I get 500
code in response.
I don't know why is it happening.
Please help me in this issue.
Upvotes: 0
Views: 792
Reputation: 7739
You shouldn't return HTTP Code headers in this way. There is dedicated function: http://php.net/manual/en/function.http-response-code.php
<?php
http_response_code(422);
http_response_code(440);
?>
Additionally, make sure you don't return anything (e.g. by echo
) before calling these commands.
Upvotes: 2