I would like to parse a json variable into another link, below is my code.
However, i'v met this error, stating that "file_get_contents(0): failed to open stream: No such file or directory ". The directory is working if I type in manually.
<?php
$data = json_decode(file_get_contents('http://movie.com/movieOne?seatNum=' + $movieSeat));
$counter = count($data);
echo "<script>movieBTN(x,y){ if (y == 'yes') { alert(x + 'Book Sucessful'); else { alert (x + 'Not sucessful');}</script>";
for ($x = 0; $x < $counter; $x++) {
echo $data[$x]->avail . "<br>" ;
$avail = $data[$x]->avail;
echo "<button onclick = movieBTN('".$movieSeat.", ".$avail."')> Movie Seat </button>";
}
?>
the $movieSeat is gotten from another json.
After I change from + to .
I have this error "Undefined offset: 0" and "Trying to get property of non-object"
vardump
array(1) { ["avail"]=> string(3) "yes" }
var_dump($movieSeat);before$data = json_decode(...);and see if you're getting the variable you expect..not a plus+