english/libraries/joomla/client/http.php
/**
	 * Method to connect to a server and get the resource.
	 *
	 * @param   JUri   $uri  The URI to connect with.
	 *
	 * @return  mixed  Connection resource on success or boolean false on failure.
	 *
	 * @since   11.1
	 */
Method to connect to a server and get the resource.
@param   JUri   $uri  The URI to connect with.

@return  mixed  Connection resource on success or boolean false on failure.


Method to connect to a server and get the resource . @param JUri $uri The URI to connect with . @return mixed Connection resource on success or boolean false on failure .
protected function _connect(JUri $uri)
	{
		$errno = null;
		$err = null;
		$host = ($uri->isSSL()) ? 'ssl://'.$uri->getHost() : $uri->getHost();
		if (!$uri->getPort())
		{
			$port = ($uri->getScheme() == 'https') ? 443 : 80;
		}
		else {
			$port = $uri->getPort();
		}
		$key = md5($host.$port);
		if (!empty($this->_connections[$key]) && is_resource($this->_connections[$key]))
		{
			$meta = stream_get_meta_data($this->_connections[$key]);
			if (!$meta['timed_out']) {
				return $this->_connections[$key];
			}
		}
		if ($this->_connections[$key] = fsockopen($host, $port, $errno, $err, $this->_timeout)) {
			stream_set_timeout($this->_connections[$key], $this->_timeout);
		}
		return $this->_connections[$key];
	}
protected function _connect ( JUri $ uri ) { $ errno = null ; $ err = null ; $ host = ( $ uri -> isSSL ( ) ) ? 'ssl://' . $ uri -> getHost ( ) : $ uri -> getHost ( ) ; if ( ! $ uri -> getPort ( ) ) { $ port = ( $ uri -> getScheme ( ) == 'https' ) ? 443 : 80 ; } else { $ port = $ uri -> getPort ( ) ; } $ key = md5 ( $ host . $ port ) ; if ( ! empty ( $ this -> _connections [ $ key ] ) && is_resource ( $ this -> _connections [ $ key ] ) ) { $ meta = stream_get_meta_data ( $ this -> _connections [ $ key ] ) ; if ( ! $ meta [ 'timed_out' ] ) { return $ this -> _connections [ $ key ] ; } } if ( $ this -> _connections [ $ key ] = fsockopen ( $ host , $ port , $ errno , $ err , $ this -> _timeout ) ) { stream_set_timeout ( $ this -> _connections [ $ key ] , $ this -> _timeout ) ; } return $ this -> _connections [ $ key ] ; }
Method to connect to a server and get the resource.
Method to connect to a server and get the resource .
// Initialize variables. // Get the host from the uri. // If the port is not explicitly set in the URI detect it. // Use the set port. // Build the connection key for resource memory caching. // If the connection already exists, use it. // Make sure the connection has not timed out. // Attempt to connect to the server.