PHP code example of vitorccs / procob-api-php
1. Go to this page and download the library: Download vitorccs/procob-api-php library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
vitorccs / procob-api-php example snippets
putenv('[email protected] ');
putenv('PROCOB_API_PWD=TesteApi');
putenv('PROCOB_API_TIMEOUT=30');
\Procob\Http\Procob::setParams([
'PROCOB_API_USER' => '[email protected] ',
'PROCOB_API_PWD' => 'TesteApi',
'PROCOB_API_TIMEOUT' => 30
]);
$consulta = \Procob\Person::getByCpfCnpj($cpfCnpj);
// CPF/CNPJ Completo
Procob\Person::getByCpfCnpj($cpfCnpj)
// CPF/CNPJ pelo Nome
Procob\Person::getByName($cpfCnpj, $params = [])
// DDD + Telefone
Procob\Person::getByPhone($ddd, $number)
// Sintegra
Procob\Person::getCpfCnpjStatus($cpfCnpj, $params = [])
// Quadro Societário / Participação em Empresa(s)
Procob\Person::getCompanyPartners($cnpj)
// Vizinhos
Procob\Person::getNeighbors($params)
// CPF/CNPJ pelo E-mail
Procob\Person::getByEmail($email)
// Número do Benefício
Procob\Person::getNationalInsuranceStatus($cpf)
// Dados Gerais
Procob\Person::getBasicData($cpfCnpj)
// Perfil CNPJ
Procob\Person::getCompanyProfile($cnpj)
use Procob\Exceptions\ProcobApiException;
use Procob\Exceptions\ProcobRequestException;
error_reporting(E_ALL);
ini_set('display_errors', 1);
b\Person::getByCpfCnpj('06.116.543/0001-55');
print_r($response);
} catch (ProcobApiException $e) { // erros retornados pela API Procob
echo sprintf("%s (%s)", $e->getMessage(), $e->getErrorCode());
} catch (ProcobRequestException $e) { // erros de servidor (erros HTTP 4xx e 5xx)
echo sprintf("%s (%s)", $e->getMessage(), $e->getErrorCode());
} catch (\Exception $e) { // demais erros
echo $e->getMessage();
}
bash
composer