php request http protocol code example
Example: php check method of http request
<?php
$method = $_SERVER['REQUEST_METHOD'];
switch ($method) {
case 'GET':
echo 'You are using '.$method.' Method';
break;
case 'POST':
echo 'You are using '.$method.' Method';
break;
case 'PUT':
echo 'You are using '.$method.' Method';
break;
case 'PATCH':
echo 'You are using '.$method.' Method';
break;
case 'DELETE':
echo 'You are using '.$method.' Method';
break;
case 'COPY':
echo 'You are using '.$method.' Method';
break;
case 'OPTIONS':
echo 'You are using '.$method.' Method';
break;
case 'LINK':
echo 'You are using '.$method.' Method';
break;
case 'UNLINK':
echo 'You are using '.$method.' Method';
break;
case 'PURGE':
echo 'You are using '.$method.' Method';
break;
case 'LOCK':
echo 'You are using '.$method.' Method';
break;
case 'UNLOCK':
echo 'You are using '.$method.' Method';
break;
case 'PROPFIND':
echo 'You are using '.$method.' Method';
break;
case 'VIEW':
echo 'You are using '.$method.' Method';
break;
Default:
echo 'You are using '.$method.' Method';
break;
}
?>