-
Notifications
You must be signed in to change notification settings - Fork 40
Location webservice
Sebastiaan Lokhorst edited this page Sep 20, 2017
·
3 revisions
The Location webservice allows you to obtain information about PostNL pickup-point locations. See the PostNL developer documentation for detailed information.
First create a API client, as usual:
use DivideBV\Postnl\Postnl;
use DivideBV\Postnl\ComplexTypes;
$client = new Postnl(...);
Get a list of locations near/around a certain postcode.
$response = $client->GetNearestLocations('1234AB');
$locations = $response->getGetLocationsResult();
foreach($locations as $location) {
// get the information you want from $location
// see ComplexTypes/ResponseLocation.php for available methods
var_dump($location);
}
Get information about a single pickup-point location, identified by its locationCode.
NOTE: This function returns a array of locations, even though it should only contain a single location.
$response = $client->getLocation('161503');
$locations = $response->getGetLocationsResult();
foreach($locations as $location) {
// get the information you want from $location
// see ComplexTypes/ResponseLocation.php for available methods
var_dump($location);
}
Get a list of locations in a rectangular area, bounded by the most north-west coordinate and the most south-east coordinate.
NOTE: The function is not yet implemented. See #40.