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.
Example #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;
 }
Example #2
0
 /**
  * @brief	Constroi o objeto que representa uma API do Correios
  * @param	ECT $ect
  */
 public function __construct(ECT $ect)
 {
     $this->ect = $ect;
     $this->httpConnection = $ect->getHTTPConnection();
     $this->httpConnection->initialize($this->getTargetHost());
 }
Example #3
0
	/**
	 * @return	HTTPConnection
	 */
	public function getHTTPConnection() {
		$httpConnection = new HTTPConnection();
		$httpConnection->addHeader( 'X-PAYPAL-APPLICATION-ID' , $this->applicationId );
		$httpConnection->addHeader( 'X-PAYPAL-REQUEST-DATA-FORMAT' , $this->requestDataFormat );
		$httpConnection->addHeader( 'X-PAYPAL-RESPONSE-DATA-FORMAT' , $this->responseDataFormat );
		$httpConnection->addHeader( 'X-Target-URI' , $this->targetHost );
		$httpConnection->setAuthenticator( $this->authenticator );
		$httpConnection->setCookieManager( new HTTPCookieManager() );
		$httpConnection->initialize( $this->targetHost , true );

		return $httpConnection;
	}