SHARE
TWEET

Untitled

a guest Mar 20th, 2019 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [
  2.   {
  3.      "id": 1
  4.       "nome": "José"
  5.   },
  6.   {
  7.      "id": 2
  8.       "nome": "João"
  9.   }
  10.  
  11. ]
  12.      
  13. $path =  explode('/', $_GET['path']);
  14. $contents = file_get_contents('tickets.json');
  15.  
  16. $json = json_decode($contents, true);
  17.  
  18. $method =  $_SERVER['REQUEST_METHOD'];
  19.  
  20. header('Content-type: application/json');
  21. $body = file_get_contents('php://input');
  22.  
  23. if ($method === 'GET') {
  24.     if ($json[$path[0]]) {
  25.         echo json_encode($json[$path[0]]);
  26.      }else{
  27.          echo '[]';
  28.      }
  29. }
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