Created
September 6, 2016 02:54
-
-
Save acras/8220ffb65a2eef93da5dc54c12954523 to your computer and use it in GitHub Desktop.
Exemplo de Cancelamento de NFse usando a API do Focus NFe em PHP com a biblioteca CURL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$ch = curl_init(); | |
$token = "aaOqeu3poIWHM1VksU7EzVKPsai9RxGyM"; //Substituir pelo token enviado pelo suporte | |
$ref = 12345; //Substituir pela sua identificação interna da nota | |
curl_setopt($ch, CURLOPT_URL, "http://homologacao.acrasnfe.acras.com.br/nfse/" . $ref . "?token=" . $token); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($ch, CURLOPT_HTTPHEADER, array()); | |
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); | |
$body = curl_exec($ch); | |
$result = curl_getinfo($ch, CURLINFO_HTTP_CODE); | |
//as três linhas abaixo imprimem as informações retornadas pela API, aqui o seu sistema deverá | |
//interpretar e lidar com o retorno | |
print("STATUS: ".$result."\n"); | |
print("BODY: ".$body."\n\n"); | |
print(""); | |
curl_close($ch); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment