-
-
Save marcosfreitas/e0b18b94309ee02323a6a5fa066d8e8f to your computer and use it in GitHub Desktop.
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 | |
<?php | |
# some constants defined | |
require('../../../config/config.php'); | |
# composer autoload | |
require(ROOT . 'app' .DS. 'vendor' .DS. 'autoload.php'); | |
$soap = new App\Soap('http://example.org/app/public/wsdl/index.php?wsdl'); | |
$params = Array( | |
'document_number' => 11784566000178, | |
'module_number' => 2, | |
'page_quantity' => 1 | |
); | |
$c = $soap->newClient(); | |
$r = $soap->request('newBoleto', $params); | |
dump($r); | |
$xml = new SimpleXmlElement($r); | |
# padrão de reposta para erros | |
if (NULL !== $xml->msg) { | |
$codigo = $xml->msg->{'record'}->codigo->__toString(); | |
if (NULL !== $xml->msg->{'record'}->descricao) { | |
$descricao = $xml->msg->{'record'}->descricao->__toString(); | |
} | |
if (NULL !== $xml->msg->{'record'}->url) { | |
$url = $xml->msg->{'record'}->url->__toString(); | |
} | |
if ($codigo == '0') { | |
\Resources\ErrorCatcher::setError( 'Algo errado aconteceu, tente novamente ou entre em contato com o suporte.<ul><li>' . $descricao, 3); | |
$log = new \Resources\Log(); | |
$log->write('Erro ao solicitar o serviço: '. $descricao . PHP_EOL . 'Módulo: ' . $module . PHP_EOL . 'Dados do Associado:'. PHP_EOL . implode(', ', $options)); | |
} else if($codigo == '1') { | |
exit; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment