src/Selenium/SeleniumServerAdapter.php
public function isSeleniumServer(): bool
    {
        // Check server properly responds to http requests
        $context = stream_context_create(['http' => ['ignore_errors' => true, 'timeout' => 5]]);
        $responseData = @file_get_contents($this->getServerUrl() . self::STATUS_ENDPOINT, false, $context);

        if (!$responseData) {
            $this->lastError = 'error reading server response';

            return false;
        }

        $decodedData = json_decode($responseData);

        if (!$decodedData) {
            $this->lastError = 'error parsing server JSON response (' . json_last_error_msg() . ')';

            return false;
        }

        $this->cloudService = $this->detectCloudServiceByStatus($decodedData);

        return true;
    }
public function isSeleniumServer(): bool
    {
        // Check server properly responds to http requests
        $context = stream_context_create(['http' => ['ignore_errors' => true, 'timeout' => 5]]);
        $responseData = @file_get_contents($this->getServerUrl() . self::STATUS_ENDPOINT, false, $context);

        if (!$responseData) {
            $this->lastError = 'error reading server response';

            return false;
        }

        $decodedData = json_decode($responseData);

        if (!$decodedData) {
            $this->lastError = 'error parsing server JSON response (' . json_last_error_msg() . ')';

            return false;
        }

        $this->cloudService = $this->detectCloudServiceByStatus($decodedData);

        return true;
    }
Test if remote server is really a Selenium server and is ready to accept connection