I'm trying to extend an old web application which uses CodeIgniter 1.7 (I know...) and am running into some trouble. I want a certain route to only be accessible via a POST request. So at the top of the function I have the following;
if ($_SERVER['REQUEST_METHOD'] != 'POST')
die ('Wrong request method: ' . $_SERVER['REQUEST_METHOD']);
Locally, on PHP 7.0.14 with PHP's built-in web server, this works fine. In production, however, on a CPanel-managed server running PHP 5.4.25, it doesn't.
When sending a POST request to my route with Postman, I get the following;
Wrong request method: GET
PUT, PATCH, DELETE, ... requests all get recognised correctly. POST requests, however, seem to magically become GET requests.
POST data I sent with the request seems to disappear as well and is not to be found in either $_POST
or $_GET
.
It seems to not be related to the CodeIgniter framework however as when I call a file outside of the framework I get the same result.
Any thoughts?