Included below is a sample of the data found in the file 1.php
:
: [
{
"ID": "1",
"active": "1",
"wait": "30"
},
{
"ID": "6",
"active": "1",
"wait": "10"
},
{
"ID": "8",
"active": "1",
"wait": "65"
}
]
}
This is my code so far, and I'm not getting very far so any help appreciated.
<?php
$url = "1.php";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec ($ch);
curl_close ($ch);
if((date("H") < 9) || (date("H") > 24)) {
echo "Closed";
} else {
echo ($Queue_Time: <= 10) ? $data : $Queue_Time-5;
};
$result = json_decode ($json);
$arr = array(1, 2);
?>
Basically, I would like to display "ID":"1" as a name, such as "Meat" "ID":"2" "Cheese" etc. Then display a queue wait time which is the value of "wait" next to the name. The shop is only open from 10am-5pm so outside of these hours I just want it to display the name and "Closed" next to it insead of the wait time.
Lastly if the wait time is greater than 10 mins, then I would like to deduct 5 mins from that value.
I am unable to get the code above to work as expected and would really appreciate a hand.
Many Thanks