forked from ekyna/Dpd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget-pudo-list.php
39 lines (26 loc) · 954 Bytes
/
get-pudo-list.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
require __DIR__ . '/../vendor/autoload.php';
use Ekyna\Component\Dpd\Exception;
use Ekyna\Component\Dpd\Pudo;
/* ---------------- Client and API ---------------- */
require __DIR__ . '/config.php';
$api = new Pudo\Api($pudoConfig);
/* ---------------- Create request ---------------- */
$request = new Pudo\Request\GetPudoListRequest();
$request->address = '32 rue de rennes';
$request->zipCode = '35230';
$request->city = 'Noyal-Châtillon-sur-Seiche';
$request->countrycode = 'FR';
$request->requestID = 'test';
$request->date_from = (new \DateTime('+1 day'))->format('d/m/Y');
/* ---------------- Get response ---------------- */
// Use API helper
try {
/** @var \Ekyna\Component\Dpd\Pudo\Response\GetPudoListResponse $response */
$response = $api->GetPudoList($request);
} catch (Exception\ExceptionInterface $e) {
echo "Error: " . $e->getMessage();
exit();
}
echo get_class($response) . "\n";
var_dump($response);