Created
September 6, 2016 02:51
-
-
Save acras/d37ac890ed0075d8c95e7d9a8bf48c16 to your computer and use it in GitHub Desktop.
Exemplo de consulta de NFSe emitida pela API Focus NFe em PHP usando 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()); | |
$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