Пример #1
0
 /**
  * Inicia os parâmetros com o curl para se comunicar com o  webservice da SEFAZ.
  * São setadas a URL de acesso o certificado que será usado e uma série de parâmetros
  * para a header do curl e caso seja usado proxy esse método o adiciona
  * @param  \Sped\Gnre\Configuration\Interfaces\Setup $setup
  * @param  $headers  array
  * @param  $data  string
  * @since  1.0.0
  */
 public function __construct(Setup $setup, $headers, $data)
 {
     $this->curlOptions = array(CURLOPT_PORT => 443, CURLOPT_VERBOSE => 1, CURLOPT_HEADER => 1, CURLOPT_SSLVERSION => 3, CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_SSL_VERIFYPEER => 0, CURLOPT_SSLCERT => $setup->getCertificatePemFile(), CURLOPT_SSLKEY => $setup->getPrivateKey(), CURLOPT_POST => 1, CURLOPT_RETURNTRANSFER => 1, CURLOPT_POSTFIELDS => $data, CURLOPT_HTTPHEADER => $headers);
     $ip = $setup->getProxyIp();
     $port = $setup->getProxyPort();
     if (!empty($ip) && $port) {
         $this->curlOptions[CURLOPT_HTTPPROXYTUNNEL] = 1;
         $this->curlOptions[CURLOPT_PROXYTYPE] = 'CURLPROXY_HTTP';
         $this->curlOptions[CURLOPT_PROXY] = $setup->getProxyIp() . ':' . $setup->getProxyPort();
     }
 }
Пример #2
0
 /**
  * Retorna o valor do ambiente armazenado no atributo interno na classe
  * @return  int
  * @since   1.0.0
  */
 public function getEnvironment()
 {
     return $this->setup->getEnvironment();
 }