public function getHost() { if ($this->initialized) { $hostname = $this->getHostName(); if ($this->secure && $this->port != HTTPConnection::HTTPS_PORT || !$this->secure && $this->port != HTTPConnection::HTTP_PORT) { return $hostname . ':' . $this->port; } else { return $hostname; } } else { throw new BadMethodCallException('Conexão não inicializada'); } }
public function open(HTTPConnection $httpConnection) { $error = null; $errno = 0; $this->handler = fsockopen($httpConnection->getHost(), $httpConnection->getPort(), $errno, $error, $httpConnection->getConnectionTimeout()); }