<?php if ($_SERVER['REQUEST_METHOD'] === 'POST') { // the request method is fine } else { exit('Invalid Request'); }