20 lines
486 B
PHP
20 lines
486 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
require __DIR__ . '/../includes/lib/server_status.php';
|
|
|
|
$targets = [
|
|
['url' => 'https://example.com'],
|
|
['url' => 'https://example.com/does-not-exist-hopefully'],
|
|
];
|
|
|
|
foreach ($targets as $t) {
|
|
$r = check_http_head($t['url']);
|
|
echo $t['url'], " => ", ($r['ok'] ? 'UP' : 'DOWN'), " code=", ($r['code'] ?? 'null'), " ms=", ($r['ms'] ?? 'null');
|
|
if (!empty($r['error'])) {
|
|
echo " error=", $r['error'];
|
|
}
|
|
echo PHP_EOL;
|
|
}
|
|
|