daily pastebin goal
44%
SHARE
TWEET

generate-php-status-code

tolikpunkoff Apr 3rd, 2018 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.     ini_set('error_reporting', E_ALL);
  3.     ini_set('display_errors', 1);
  4.     ini_set('display_startup_errors', 1);
  5.    
  6.     $code=0;
  7.     if (empty($_GET))
  8.     {
  9.         echo "Use ?code=http_status_code";     
  10.     }
  11.     else
  12.     {
  13.         if (!isset($_GET['code']))
  14.         {
  15.             echo "Use ?code=http_status_code";
  16.         }
  17.         else
  18.         {
  19.             $code=$_GET['code'];
  20.             if (($code<100)||($code>599))
  21.             {
  22.                 echo "Wrong code (min 100, max 599)";
  23.             }
  24.             else
  25.             {
  26.                 echo $code;
  27.                 http_response_code($code);
  28.             }
  29.         }
  30.     }  
  31. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top