Skip to content

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.

Example

First create a API client, as usual:

use DivideBV\Postnl\Postnl;
use DivideBV\Postnl\ComplexTypes;

$client = new Postnl(...);

GetNearestLocations

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);
}

GetLocation

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);
}

GetLocationsInArea

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.

Clone this wiki locally