host = $host; $this->port = $port; } public function connect() { $this->socket = fsockopen($this->host, $this->port, $errno, $errstr, 5); if (!$this->socket) { throw new \Exception("Management connection failed: $errstr ($errno)"); } stream_set_timeout($this->socket, 2); $this->send("log on"); } private function send($cmd) { fwrite($this->socket, "$cmd\n"); } public function getTlsErrors() { $this->connect(); $errors = []; while (!feof($this->socket)) { $line = fgets($this->socket); if (str_contains($line, 'TLS Error') || str_contains($line, 'VERIFY ERROR')) { $errors[] = trim($line); } } fclose($this->socket); return $errors; } }