8 lines
499 B
PHP
8 lines
499 B
PHP
<?php
|
|
header('Content-Type: application/json');
|
|
$ch=curl_init('http://127.0.0.1:8000/api/health');
|
|
curl_setopt_array($ch,[CURLOPT_RETURNTRANSFER=>true,CURLOPT_TIMEOUT=>3,CURLOPT_CONNECTTIMEOUT=>2]);
|
|
$r=curl_exec($ch);$code=curl_getinfo($ch,CURLINFO_HTTP_CODE);curl_close($ch);
|
|
if(!$code)$code=intval(shell_exec("curl -so/dev/null -w '%{http_code}' http://127.0.0.1:8000/ 2>/dev/null"));
|
|
echo json_encode(['status'=>$code>=200&&$code<400?'ok':'down','code'=>$code,'service'=>'Plausible Analytics']);
|