/** * buscaCNPJ * * @param string $cnpj * @return array */ function buscaCNPJ($cnpj) { try { $spider = new SintegraSpider(); return $spider->consultaCNPJ($cnpj); } catch (Exception $e) { throw new SoapFault((string) $e->getCode(), $e->getMessage()); } }
<?php include dirname(__FILE__) . '/SintegraSpider.php'; try { $cnpj = isset($_GET['cnpj']) ? $_GET['cnpj'] : $argv[1]; $spider = new SintegraSpider(); $sintegra = $spider->consultaCNPJ($cnpj); print_r($sintegra); } catch (Exception $e) { echo $e->getMessage() . "\n"; }
<?php require_once 'autoload.php'; $spider = new SintegraSpider(); echo $spider->get_data_as_json();