echo $_SERVER['REQUEST_METHOD']; /** GET, POST, DELETE, COPY, MOVE, PUT OR OPTIONS **/
Question: Give an example for getting different type of Request type?
$method =$_SERVER['REQUEST_METHOD']; switch ($method) { case 'PUT': /* write here your code */ break; case 'POST': /* write here your code */ break; case 'GET': /* write here your code */ break; case 'HEAD': /* write here your code */ break; case 'DELETE': /* write here your code */ break; case 'OPTIONS': /* write here your code */ break; default: echo "Unexpected request type"; break; }