· 6 years ago · Apr 27, 2020, 03:14 PM
1<!DOCTYPE html>
2<html xmlns="http://www.w3.org/1999/xhtml">
3 <head>
4 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
5
6 <title>NIP24 Client - Example</title>
7 </head>
8
9 <body>
10 <?php
11 // enable debug information
12 ini_set('display_errors', 1);
13 error_reporting(E_ALL);
14
15 // nip24 api
16 require_once 'NIP24/NIP24Client.php';
17
18 \NIP24\NIP24Client::registerAutoloader();
19
20 // Utworzenie obiektu klienta usługi serwisu produkcyjnego
21 // id – ciąg znaków reprezentujący identyfikator klucza API
22 // key – ciąg znaków reprezentujący klucz API
23 // $nip24 = new \NIP24\NIP24Client('id', 'key');
24
25 // Utworzenie obiektu klienta usługi serwisu testowego
26 $nip24 = new \NIP24\NIP24Client();
27
28 $nip = '7171642051';
29 $nip_eu = 'PL' . $nip;
30 $account_number = '49154000046458439719826658';
31
32 // // Sprawdzenie stanu konta
33 // $account = $nip24->getAccountStatus();
34
35 // if ($account) {
36 // echo '<pre>' . print_r($account, true) . '</pre>';
37 // }
38 // else {
39 // echo '<p>Błąd: ' . $nip24->getLastError() . ' (kod: ' . $nip24->getLastErrorCode() . ')</p>';
40 // }
41
42 $all = $nip24->getAllDataExt(\NIP24\Number::NIP, $nip);
43
44 if ($all) {
45 echo '<pre>' . print_r($all, true) . '</pre>';
46 }
47 else {
48 echo '<p>Błąd: ' . $nip24->getLastError() . ' (kod: ' . $nip24->getLastErrorCode() . ')</p>';
49 }
50
51 ?>
52 </body>
53</html>