PHP code example of elifuzz / postcode-nl

1. Go to this page and download the library: Download elifuzz/postcode-nl library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

elifuzz / postcode-nl example snippets


try {
    $client = new RestApi\RestClient('{your key}', '{your secret}');
    $address = $client->lookupAddress('{postcode}', '{houseNumber}', '{houseNumberAddition}');
    var_dump($address);
} catch (RestApi\Exception\AddressNotFoundException $e) {
    die($e->getMessage());
} catch (RestApi\Exception\InputInvalidException $e) {
    die($e->getMessage());
} catch (RestApi\Exception\AuthenticationException $e) {
    die($e->getMessage());
} catch (RestApi\Exception\ServiceException $e) {
    die($e->getMessage());
}