In PHP è semplice filtrare il tipo di richieste HTTP consentite.
La soluzione è la seguente:
function is_valid_request() {
$allowed = ['GET', 'POST'];
return in_array($_SERVER['REQUEST_METHOD'], $allowed);
}
In PHP è semplice filtrare il tipo di richieste HTTP consentite.
La soluzione è la seguente:
function is_valid_request() {
$allowed = ['GET', 'POST'];
return in_array($_SERVER['REQUEST_METHOD'], $allowed);
}