src/Context/Initializer/ApiClientAwareInitializer.php
private function validateConnection($baseUri) {
        $parts = parse_url($baseUri);
        $host = $parts['host'];
        $port = isset($parts['port']) ? $parts['port'] : ($parts['scheme'] === 'https' ? 443 : 80);

        set_error_handler(function () {
            return true;
        });

        $resource = fsockopen($host, $port);
        restore_error_handler();

        if ($resource === false) {
            // Can't connect
            return false;
        }

        // Connection successful, close connection
        fclose($resource);

        return true;
    }
private function validateConnection($baseUri) {
        $parts = parse_url($baseUri);
        $host = $parts['host'];
        $port = isset($parts['port']) ? $parts['port'] : ($parts['scheme'] === 'https' ? 443 : 80);

        set_error_handler(function () {
            return true;
        });

        $resource = fsockopen($host, $port);
        restore_error_handler();

        if ($resource === false) {
            // Can't connect
            return false;
        }

        // Connection successful, close connection
        fclose($resource);

        return true;
    }
private function validateConnection ( $ baseUri ) { $ parts = parse_url ( $ baseUri ) ; $ host = $ parts [ 'host' ] ; $ port = isset ( $ parts [ 'port' ] ) ? $ parts [ 'port' ] : ( $ parts [ 'scheme' ] === 'https' ? 443 : 80 ) ; set_error_handler ( function ( ) { return true ; } ) ; $ resource = fsockopen ( $ host , $ port ) ; restore_error_handler ( ) ; if ( $ resource === false ) { // Can't connect return false ; } // Connection successful, close connection fclose ( $ resource ) ; return true ; }
Validate a connection to the base URI

@param string $baseUri
@return boolean
Validate a connection to the base URI