I'm looking for something like HttpResponseCode::FileNotFound
=> 404, HttpResponseCode::OK
=> 200
I've searched for "php http status codes list", "php http status codes enum" and couldnt find anything.
For PHP versions 4.0: In order to send the HTTP response code, we need to assemble the response code. To achieve this, use header() function. The header() function contains a special use-case which can detect a HTTP response line and replace that with a custom one. header( "HTTP/1.1 404 Not Found" );
Occasionally, you may need to set a different status code on the response from your Servlet. To set a different HTTP status code from your Servlet, call the following method on the HttpServletResponse object passed in to your server: res. setStatus(nnn);
An HTTP response is made by a server to a client. The aim of the response is to provide the client with the resource it requested, or inform the client that the action it requested has been carried out; or else to inform the client that an error occurred in processing its request.
The term to search for is "php http status codes const" which leads you to http://symfony.com/blog/new-in-symfony-2-4-using-constants-for-http-status-code - It has \Illuminate\Http\Response::HTTP_NOT_FOUND
and \Illuminate\Http\Response::HTTP_OK
etc.
List is here - https://github.com/symfony/HttpFoundation/blob/master/Response.php
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With