HTTPConnection::initialize PHP Method

initialize() public method

public initialize ( string $hostname, boolean $secure = false, integer $port = HTTPConnection::HTTP_PORT, integer $connectionTimeout, integer $timeout )
$hostname string Servidor que receberá a requisição.
$secure boolean Indica se a conexão será segura (https).
$port integer Porta da requisição.
$connectionTimeout integer Timeout de conexão em segundos.
$timeout integer Timeout de espera em segundos.
    public function initialize($hostname, $secure = false, $port = HTTPConnection::HTTP_PORT, $connectionTimeout = 0, $timeout = 0)
    {
        if ($this->initialized) {
            $this->close();
        }
        $this->initialized = true;
        $this->hostname = $hostname;
        $this->secure = $secure === true;
        if (func_num_args() == 2) {
            $this->port = $this->secure ? HTTPConnection::HTTPS_PORT : HTTPConnection::HTTP_PORT;
        } else {
            $this->port = (int) $port;
        }
        $this->connectionTimeout = (int) $connectionTimeout;
        $this->timeout = (int) $timeout;
    }

Usage Example

Beispiel #1
0
 /**
  * @brief	Conexão HTTP
  * @details	Recupera um objeto de conexão HTTP para ser utilizado
  * nas chamadas às operações da API.
  * @return	HTTPConnection
  */
 public function getHTTPConnection()
 {
     $httpConnection = new HTTPConnection();
     $httpConnection->setAuthenticator($this->httpAuthenticator);
     $httpConnection->setCookieManager(new HTTPCookieManager());
     $httpConnection->initialize($this->host, $this->secure, $this->port);
     return $httpConnection;
 }
All Usage Examples Of HTTPConnection::initialize