[ 'verify_peer' => false, 'verify_peer_name' => false, ], ]); } } $response = @file_get_contents($endpointUrl, false, $context ?: null); if ($response === false && strcasecmp($scheme, 'https') === 0) { $fallbackUrl = preg_replace('#^https#i', 'http', $endpointUrl); $response = @file_get_contents($fallbackUrl); if ($response !== false) { $endpointUrl = $fallbackUrl; } } if ($response === false) { throw new RuntimeException('Unable to reach shared endpoint: ' . $endpointUrl); } try { $payload = json_decode($response, true, flags: JSON_THROW_ON_ERROR); } catch (JsonException $exception) { throw new RuntimeException('Malformed JSON from shared endpoint', 0, $exception); } if (($payload['status'] ?? null) !== 'ok') { $message = $payload['message'] ?? 'unknown error'; throw new RuntimeException('Shared endpoint returned an error: ' . $message); } if (!isset($payload['items']) || !is_array($payload['items'])) { $snippet = substr(strip_tags($response), 0, 200); throw new RuntimeException('Shared endpoint response missing items. Snippet: ' . $snippet); } foreach ($payload['items'] as $item) { $tagKey = str_pad((string) $item['tagId'], 5, '0', STR_PAD_LEFT); $value[$item['name']] = $item['value']; $rounded[$item['name']] = $item['rounded1']; $rounded1[$item['name']] = $item['rounded2']; $roundedid[$tagKey] = $item['rounded2']; $ID[$tagKey] = $item['value']; } $endpointDataLoaded = true; } catch (Throwable $exception) { $endpointErrorMessage = $exception->getMessage(); error_log('Milling shared endpoint failed: ' . $endpointErrorMessage); } $dataSourceLabel = 'Shared endpoint'; if (!$endpointDataLoaded) { require __DIR__ . '/../items.php'; require __DIR__ . '/../items2dec.php'; $dataSourceLabel = 'Legacy items.php data'; } // Helper function for rendering data rows function renderDataRow($label, $value, $unit = "") { $safeValue = htmlspecialchars($value); return " $label $safeValue $unit "; } ?>
EAST MILL TANDEM
A"; } if ($value['MILL1AUTOMAN'] == 1) { echo ""; } ?> " . $value['WEIGHT_WSP'] . " "; } if ($value['LEVEL_THROUGHPUT_SWITCH'] == 0) { echo ""; } ?> Tons/Hr"; } if ($value['LEVEL_THROUGHPUT_SWITCH'] == 0) { echo ""; } ?> A"; } if ($value['MILL1AUTOMAN1'] == 0) { echo ""; } ?>
Level SP RPM Mill 1 OP % M
1 MCC FPM FPM
2 MCC Output %
3 MCC Tons Tons
4 Mill 1 SP " . $value['WEIGHT_WSP'] . " %M
5 Grinding Rate Tons/Hr
6 Average Rate Tons/15/Min
Imibition 6: GPM Imibition 6 SP: GPM
Imibition 5: GPM Imibition 5 SP: GPM
WEST MILL TANDEM
Level SP RPM
1 BC-09 FPM FPM
2 BC-09 Output
3 BC-09 Tons Tons
4 Mill 1 SP %
5 Grinding Rate Tons/Hr
Average Rate Tons/15Min
Imibition: GPM Imibition SP: GPM