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 :: php const 
Php :: json_decode object to array 
Php :: php file upload error 
Php :: load database in codeigniter 
Php :: hmtl dellete tag php 
Php :: php empty object 
Php :: the posts pagination 
Php :: register_post_type wordpress 
Php :: model json laravel accessor to convert to array 
Php :: laravel migration index 
Php :: php strftime 
Php :: laravel use session values in view 
Php :: php date object to timestamp 
Php :: laravel model update 
Php :: why pusher not working in laravel 
Php :: php test page 
Php :: convert numeric array to string array php 
Php :: Notice: Trying to access array offset on value of type int in /var/www/pdam/modules/phpexcel/PHPExcel/Cell/DefaultValueBinder.php on line 82 
Php :: laravel iteration 
Php :: str_contains 
Php :: scribe laravel 
Php :: laravel csrf token mismatch postman 
Php :: how to make-migrations in laravel 
Php :: laravel change foreign key name 
Php :: where is the php ini file located on server 
Php :: php color generator 
Php :: left join laravel 
Php :: redirect compact laravel 
Php :: how to make doctrine schema update in symfony 2.8 
Php :: twig for loop key 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =