(in_array($this->port, array(443, 8443, 9443))) { + $context = stream_context_create(); + stream_context_set_option($context, 'ssl', 'verify_peer', false); + stream_context_set_option($context, 'ssl', 'verify_host', false); + stream_context_set_option($context, 'ssl', 'allow_self_signed', true); + $fp = stream_socket_client($this->addr . ':' . $this->port, + $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT, $context); + } else { + $fp = @$openfunc($this->addr, $this->port, $errno, $errstr, $timeout); + }