使用cURL和PHP操作对象

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

I've taken a few liberties in trying to get what you want, so let me know how close it is:

// Assuming we have a correctly formatted JSON array from CURL
$data = '[
    {
        "ID": "1",
        "active": "1",
        "wait": "30"
    },
    {
        "ID": "6",
        "active": "1",
        "wait": "10"
    },
    {
        "ID": "8",
        "active": "1",
        "wait": "65"
    }
]
';

// This array maps IDs to Names
$department[1] = 'Meat';
$department[2] = 'Cheese';
$department[6] = 'Fish';
$department[8] = 'Vegetables';

// Decode the JSON data
$data = json_decode($data);

// Loop through each area
foreach ($data as $counter) {
    // Check if closed
    if((date("H") < 10) || (date("H") > 17)) {
        $queue = "Closed";
    } else {
        $queue = ($counter->wait <= 10) ? $counter->wait : $counter->wait-5;
    };
    // Output name and wait time
    echo $department[$counter->ID].' '.$queue.'<br />';

}