Encontra-se da seguinte forma!
protected function __sendCURLNFSe($urlsefaz,$namespace,$cabecalho,$dados,$metodo,$ambiente='',$UF=''){
if ($urlsefaz == ''){
//não houve retorno
$this->errMsg = "URL do webservice não disponível.\n";
$this->errStatus = true;
}
if ($ambiente == ''){
$ambiente = $this->tpAmb;
}
$data = '';
$data .= '<?xml version="1.0" encoding="UTF-8"?>';
$data .= '<soapenv:Envelope ';
$data .= '<soapenv:Header/>';
$data .= '<soapenv:Body>';
$data .= '<cabec>';
$data .= $cabecalho;
$data .= '</cabec>';
$data .= '<msg>';
$data .= $dados;
$data .= '</msg>';
$data .= '</RecepcionarLoteRps>';
$data .= '</soapenv:Body>';
$data .= '</soapenv:Envelope>';
//[Informational 1xx]
$cCode['100']="Continue";
$cCode['101']="Switching Protocols";
//[Successful 2xx]
$cCode['200']="OK";
$cCode['201']="Created";
$cCode['202']="Accepted";
$cCode['203']="Non-Authoritative Information";
$cCode['204']="No Content";
$cCode['205']="Reset Content";
$cCode['206']="Partial Content";
//[Redirection 3xx]
$cCode['300']="Multiple Choices";
$cCode['301']="Moved Permanently";
$cCode['302']="Found";
$cCode['303']="See Other";
$cCode['304']="Not Modified";
$cCode['305']="Use Proxy";
$cCode['306']="(Unused)";
$cCode['307']="Temporary Redirect";
//[Client Error 4xx]
$cCode['400']="Bad Request";
$cCode['401']="Unauthorized";
$cCode['402']="Payment Required";
$cCode['403']="Forbidden";
$cCode['404']="Not Found";
$cCode['405']="Method Not Allowed";
$cCode['406']="Not Acceptable";
$cCode['407']="Proxy Authentication Required";
$cCode['408']="Request Timeout";
$cCode['409']="Conflict";
$cCode['410']="Gone";
$cCode['411']="Length Required";
$cCode['412']="Precondition Failed";
$cCode['413']="Request Entity Too Large";
$cCode['414']="Request-URI Too Long";
$cCode['415']="Unsupported Media Type";
$cCode['416']="Requested Range Not Satisfiable";
$cCode['417']="Expectation Failed";
//[Server Error 5xx]
$cCode['500']=" Internal Server Error";
$cCode['501']="Not Implemented";
$cCode['502']="Bad Gateway";
$cCode['503']="Service Unavailable";
$cCode['504']="Gateway Timeout";
$cCode['505']="HTTP Version Not Supported";
$tamanho = strlen($data);
//$metodo = 'EnviarLoteRpsEnvio';
// $parametros = array('Content-Type: application/soap+xml;charset=utf-8;action="'.$namespace. '"','SOAPAction: "'.$metodo.'"',"Content-length: $tamanho");
//$parametros = array('Content-Type: application/soap+xml;charset=utf-8;action="'.$namespace."/".$metodo.'"','SOAPAction: "'.$metodo.'"',"Content-length: $tamanho");
$parametros = array(
"Content-type: text/xml;charset=UTF-8",
"Accept: text/xml",
"Content-length: ". $tamanho,
);
$_aspa = '"';
$oCurl = curl_init();
if(is_array($this->aProxy)){
curl_setopt($oCurl, CURLOPT_HTTPPROXYTUNNEL, 1);
curl_setopt($oCurl, CURLOPT_PROXYTYPE, "CURLPROXY_HTTP");
curl_setopt($oCurl, CURLOPT_PROXY, $this->aProxy['IP'].':'.$this->aProxy['PORT']);
if( $this->aProxy['PASS'] != '' ){
curl_setopt($oCurl, CURLOPT_PROXYUSERPWD, $this->aProxy['USER'].':'.$this->aProxy['PASS']);
curl_setopt($oCurl, CURLOPT_PROXYAUTH, "CURLAUTH_BASIC");
} //fim if senha proxy
}//fim if aProxy
curl_setopt($oCurl, CURLOPT_URL, $urlsefaz.'');
curl_setopt($oCurl, CURLOPT_PORT , 443);
curl_setopt($oCurl, CURLOPT_VERBOSE, 1);
curl_setopt($oCurl, CURLOPT_HEADER, 1); //retorna o cabeçalho de resposta
curl_setopt($oCurl, CURLOPT_SSLVERSION, 3);
curl_setopt($oCurl, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($oCurl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($oCurl, CURLOPT_SSLCERT, $this->pubKEY);
curl_setopt($oCurl, CURLOPT_SSLKEY, $this->priKEY);
curl_setopt($oCurl, CURLOPT_POST, 1);
curl_setopt($oCurl, CURLOPT_POSTFIELDS, $data);
curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($oCurl, CURLOPT_HTTPHEADER,$parametros);
$__xml = curl_exec($oCurl);
$info = curl_getinfo($oCurl); //informações da conexão
//header("Content-Type: text/html");
// print_r($info);
//die;
$txtInfo ="";
$txtInfo .= "URL=$info[url]\n";
$txtInfo .= "Content type=$info[content_type]\n";
$txtInfo .= "Http Code=$info[http_code]\n";
$txtInfo .= "Header Size=$info[header_size]\n";
$txtInfo .= "Request Size=$info[request_size]\n";
$txtInfo .= "Filetime=$info[filetime]\n";
$txtInfo .= "SSL Verify Result=$info[ssl_verify_result]\n";
$txtInfo .= "Redirect Count=$info[redirect_count]\n";
$txtInfo .= "Total Time=$info[total_time]\n";
$txtInfo .= "Namelookup=$info[namelookup_time]\n";
$txtInfo .= "Connect Time=$info[connect_time]\n";
$txtInfo .= "Pretransfer Time=$info[pretransfer_time]\n";
$txtInfo .= "Size Upload=$info[size_upload]\n";
$txtInfo .= "Size Download=$info[size_download]\n";
$txtInfo .= "Speed Download=$info[speed_download]\n";
$txtInfo .= "Speed Upload=$info[speed_upload]\n";
$txtInfo .= "Download Content Length=$info[download_content_length]\n";
$txtInfo .= "Upload Content Length=$info[upload_content_length]\n";
$txtInfo .= "Start Transfer Time=$info[starttransfer_time]\n";
$txtInfo .= "Redirect Time=$info[redirect_time]\n";
//$txtInfo .= "Certinfo=$info[certinfo]\n";
$n = strlen($__xml);
$x = stripos($__xml, "<");
$xml = substr($__xml, $x, $n-$x);
$this->soapDebug = $data."\n\n".$txtInfo."\n".$__xml;
if ($__xml === false){
//não houve retorno
$this->errMsg = curl_error($oCurl) . $info['http_code'] . $cCode[$info['http_code']]."\n";
$this->errStatus = true;
} else {
//houve retorno mas ainda pode ser uma mensagem de erro do webservice
$this->errMsg = $info['http_code'] . $cCode[$info['http_code']]."\n";
$this->errStatus = false;
}
curl_close($oCurl);
return $xml;