sendRequest(); if ($res == null) { echo 'Traefik connection failed'; return; } switch($res->getStatusCode()) { case 200: $data = json_decode($res->getBody()); echo "Successfully connected with status: ".$data->result."\n"; break; case 404: echo 'Failed: Please make sure your URL is correct and includes the port'; break; default: echo 'Something went wrong... Code: '.$res->getStatusCode(); break; } } public function executeConfig() { $html = ''; $active = 'inactive'; $res = $this->sendRequest(); $data = json_decode($res->getBody()); if ($data) { $avg_response_time = $data->average_response_time_sec; $time = $avg_response_time*1000; $time_output = number_format($time, 2); $active = ($time > 0) ? 'active' : 'inactive'; $html = '