1. Go to this page and download the library: Download gusapi/gusapi 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/ */
gusapi / gusapi example snippets
use GusApi\Exception\InvalidUserKeyException;
use GusApi\Exception\NotFoundException;
use GusApi\GusApi;
use GusApi\ReportTypes;
use GusApi\BulkReportTypes;
$gus = new GusApi('your api key here');
//for development server use:
//$gus = new GusApi('abcde12345abcde12345', 'dev');
try {
$nipToCheck = 'xxxxxxxxxx'; //change to valid nip value
$gus->login();
$gusReports = $gus->getByNip($nipToCheck);
var_dump($gus->dataStatus());
var_dump($gus->getBulkReport(
new DateTimeImmutable('2019-05-31'),
BulkReportTypes::REPORT_DELETED_LOCAL_UNITS
));
foreach ($gusReports as $gusReport) {
//you can change report type to other one
$reportType = ReportTypes::REPORT_PERSON;
echo $gusReport->getName();
echo 'Address: ' . $gusReport->getStreet() . ' ' . $gusReport->getPropertyNumber() . '/' . $gusReport->getApartmentNumber();
$fullReport = $gus->getFullReport($gusReport, $reportType);
var_dump($fullReport);
}
} catch (InvalidUserKeyException $e) {
echo 'Bad user key';
} catch (NotFoundException $e) {
echo 'No data found <br>';
echo 'For more information read server message below: <br>';
echo sprintf(
"StatusSesji:%s\nKomunikatKod:%s\nKomunikatTresc:%s\n",
$gus->getSessionStatus(),
$gus->getMessageCode(),
$gus->getMessage()
);
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.