Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php check method of http request

<?php

$method = $_SERVER['REQUEST_METHOD'];

switch ($method) {
  case 'GET':
    //Here Handle GET Request
    echo 'You are using '.$method.' Method';
    break;
  case 'POST':
    //Here Handle POST Request
    echo 'You are using '.$method.' Method';
    break;
  case 'PUT':
    //Here Handle PUT Request
    echo 'You are using '.$method.' Method';
    break;
  case 'PATCH':
    //Here Handle PATCH Request
    echo 'You are using '.$method.' Method';
    break;
  case 'DELETE':
    //Here Handle DELETE Request
    echo 'You are using '.$method.' Method';
    break;
  case 'COPY':
      //Here Handle COPY Request
      echo 'You are using '.$method.' Method';
      break;

  case 'OPTIONS':
      //Here Handle OPTIONS Request
      echo 'You are using '.$method.' Method';
      break;
  case 'LINK':
      //Here Handle LINK Request
      echo 'You are using '.$method.' Method';
      break;
  case 'UNLINK':
      //Here Handle UNLINK Request
      echo 'You are using '.$method.' Method';
      break;
  case 'PURGE':
      //Here Handle PURGE Request
      echo 'You are using '.$method.' Method';
      break;
  case 'LOCK':
      //Here Handle LOCK Request
      echo 'You are using '.$method.' Method';
      break;
  case 'UNLOCK':
      //Here Handle UNLOCK Request
      echo 'You are using '.$method.' Method';
      break;
  case 'PROPFIND':
      //Here Handle PROPFIND Request
      echo 'You are using '.$method.' Method';
      break;
  case 'VIEW':
      //Here Handle VIEW Request
      echo 'You are using '.$method.' Method';
      break;
  Default:
    echo 'You are using '.$method.' Method';
  break;
}


?>
Comment

php check request method

$_SERVER['REQUEST_METHOD']
Comment

PREVIOUS NEXT
Code Example
Php :: use of segment in laravel 8 
Php :: validation file laravel 
Php :: store file into specific directory laravel using storage facade 
Php :: php remove extension from url 
Php :: laravel order by desc 
Php :: php contruct parent 
Php :: laravel show routes artisan 
Php :: show all terms of a custom taxonomy 
Php :: get last character of string php 
Php :: laravel description substring 
Php :: grep only in php files 
Php :: drupal 8 get all nodes of type 
Php :: prepend 0 to number php 
Php :: laravel debugbar 
Php :: laravel carbon time format AM PM 
Php :: laravel run seed 
Php :: print all session variables php 
Php :: wordpress Access-Control-Allow-Origin 
Php :: laravel custom model primary Key 
Php :: ucwords in php 
Php :: php get ip to location 
Php :: category name wp query 
Php :: laravel make trait command 
Php :: db not found in laravel 
Php :: unix timestamp in php 
Php :: importing current year in laravel blade 
Php :: laravel check auth 
Php :: wordpress featured image as a background image 
Php :: choose a random word from an array php 
Php :: php date + 1 year 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =