Skip to content

Location webservice

Sebastiaan Lokhorst edited this page Jul 13, 2017 · 3 revisions

The Location webservice allows you to obtain information about PostNL pickup-point locations.

Example

See README.md for basic usage.

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.

NOTE: The function is implemented under a different name (GetNearestLocation instead of (GetNearestLocations) in the library. See #48.

$response = $client->GetNearestLocation('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