php - Get json data from file at random locations -
i trying upload files json data php server @ web-hotel, on serverside php not able locate file i`m sending up. have tried this
require_once 'db.php'; $jsondata = file_get_contents("movies.json"); $json = json_decode($jsondata,true); echo $json['movies'][0]['title']; $output ="<ul>"; foreach($json['movies'] $movie){ $output .="<h4>".$movie['title']."</h4>"; $output .="<li> year".$movie['year']."</li>"; $output .="<li> genre".$movie['genre']."</li>"; $output .="<li> director" .$movie['director']."</li>"; } $output .="</ul>"; echo $output; ?>
which works fine if have file called "movies.json" in same directory php code, problem is, send file different raspberry pi´s, not have url file_get_contents(), how overcome this?
any response appreciated
Comments
Post a Comment