adam-prescott

WSt

Apr 3rd, 2014
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.44 KB | None | 0 0
  1. <?php
  2.  
  3. $jsonstr = file_get_contents('../readings.json');
  4. if($jsonstr != false) {
  5.     $json = json_decode($jsonstr, true);
  6.    
  7.     if($json == NULL) {
  8.         // JSON Decode Error
  9.         $jout = array('error'=>true);
  10.         echo json_encode($jout);
  11.     } else {
  12.         $json["error"]=false;
  13.         echo json_encode($json);
  14.     }
  15. } else {
  16.     // File Read Error
  17.     $jout = array('error'=>true);
  18.     echo json_encode($jout);
  19. }
  20.  
  21. ?>
Advertisement
Add Comment
Please, Sign In to add comment