405
HTTP status code 405 indicates that the request method is not allowed for the requested resource. This status code is used when the server recognizes the request method but the method is not supported for the resource.
To handle a 405 status code in PHP, you can set the HTTP response code and display an error message. Here is an example:
<?php
// Set the HTTP response code to 405
http_response_code(405);
// Display an error message
echo 'Method Not Allowed: The request method is not supported for the requested resource.';
Last modified: 14 December 2024