<?php

header('Content-Type: text/html; charset=utf-8');
if (isset($_POST['conteudoArquivo']) || strlen(trim($_POST['conteudoArquivo'])) > 0) {
    require_once '../../libs/NFe/ToolsNFePHP.class.php';
    $nfe = new ToolsNFePHP();
    if ($xml = $nfe->signXML($_POST['conteudoArquivo'], 'infNFe')) {
        echo trim($xml);
    } else {
        echo 'ERRO: ' . $nfe->errMsg;
    }
    die;
}
echo 'ERRO: O conteúdo está vazio!';
示例#2
0
<?php

require_once dirname(__FILE__) . '/../../libs/NFe/ToolsNFePHP.class.php';
$nfe = new ToolsNFePHP();
$file = dirname(__FILE__) . '/../xml/35101158716523000119550010000000011003000000-nfe.xml';
$arq = file_get_contents($file);
if ($xml = $nfe->signXML($arq, 'infNFe')) {
    file_put_contents($file, $xml);
} else {
    echo $nfe->errMsg;
}
示例#3
0
 /**
  * @expectedException nfephpException
  * @expectedExceptionMessage Um xml deve ser passado para que seja assinado!!
  */
 public function testExceptionAoAssinarArquivoXmlArquivoOuConteudoNaoInformado()
 {
     $tool = new ToolsNFePHP($this->configTest, 1, true);
     $tool->signXML('', 'infNFe');
 }