library/PostcodeNl/Api/RestClient.php
public function lookupAddress($postcode, $houseNumber, $houseNumberAddition = '', $validateHouseNumberAddition = false)
	{
		// Remove spaces in postcode ('1234 AB' should be '1234AB')
		$postcode = str_replace(' ', '', trim($postcode));
		$houseNumber = trim($houseNumber);
		$houseNumberAddition = trim($houseNumberAddition);

		if ($houseNumberAddition == '')
		{
			// If people put the housenumber addition in the housenumber field - split this.
			list($houseNumber, $houseNumberAddition) = $this->splitHouseNumber($houseNumber);
		}

		// Test postcode format
		if (!$this->isValidPostcodeFormat($postcode))
			throw new PostcodeNl_Api_RestClient_InputInvalidException('Postcode `'. $postcode .'` needs to be in the 1234AB format.');
		// Test housenumber format
		if (!ctype_digit($houseNumber))
			throw new PostcodeNl_Api_RestClient_InputInvalidException('House number `'. $houseNumber .'` must contain digits only.');

		// Use the regular validation function
		$url = $this->_restApiUrl .'/addresses/postcode/' . rawurlencode($postcode). '/'. rawurlencode($houseNumber) . '/'. rawurlencode($houseNumberAddition);

		$response = $this->_doRestCall($url);

		$this->_checkResponse($response);

		// Strictly enforce housenumber addition validity
		if ($validateHouseNumberAddition)
		{
			if ($response['data']['houseNumberAddition'] === null)
				throw new PostcodeNl_Api_RestClient_InputInvalidException('Housenumber addition `'. $houseNumberAddition .'` is not known for this address, valid additions are: `'. implode('`, `', $response['data']['houseNumberAdditions']) .'`.');
		}

		// Successful response!
		return $response['data'];
	}
public function lookupAddress($postcode, $houseNumber, $houseNumberAddition = '', $validateHouseNumberAddition = false)
	{
		// Remove spaces in postcode ('1234 AB' should be '1234AB')
		$postcode = str_replace(' ', '', trim($postcode));
		$houseNumber = trim($houseNumber);
		$houseNumberAddition = trim($houseNumberAddition);

		if ($houseNumberAddition == '')
		{
			// If people put the housenumber addition in the housenumber field - split this.
			list($houseNumber, $houseNumberAddition) = $this->splitHouseNumber($houseNumber);
		}

		// Test postcode format
		if (!$this->isValidPostcodeFormat($postcode))
			throw new PostcodeNl_Api_RestClient_InputInvalidException('Postcode `'. $postcode .'` needs to be in the 1234AB format.');
		// Test housenumber format
		if (!ctype_digit($houseNumber))
			throw new PostcodeNl_Api_RestClient_InputInvalidException('House number `'. $houseNumber .'` must contain digits only.');

		// Use the regular validation function
		$url = $this->_restApiUrl .'/addresses/postcode/' . rawurlencode($postcode). '/'. rawurlencode($houseNumber) . '/'. rawurlencode($houseNumberAddition);

		$response = $this->_doRestCall($url);

		$this->_checkResponse($response);

		// Strictly enforce housenumber addition validity
		if ($validateHouseNumberAddition)
		{
			if ($response['data']['houseNumberAddition'] === null)
				throw new PostcodeNl_Api_RestClient_InputInvalidException('Housenumber addition `'. $houseNumberAddition .'` is not known for this address, valid additions are: `'. implode('`, `', $response['data']['houseNumberAdditions']) .'`.');
		}

		// Successful response!
		return $response['data'];
	}
public function lookupAddress ( $ postcode , $ houseNumber , $ houseNumberAddition = '' , $ validateHouseNumberAddition = false ) { // Remove spaces in postcode ('1234 AB' should be '1234AB') $ postcode = str_replace ( ' ' , '' , trim ( $ postcode ) ) ; $ houseNumber = trim ( $ houseNumber ) ; $ houseNumberAddition = trim ( $ houseNumberAddition ) ; if ( $ houseNumberAddition == '' ) { // If people put the housenumber addition in the housenumber field - split this. list ( $ houseNumber , $ houseNumberAddition ) = $ this -> splitHouseNumber ( $ houseNumber ) ; } // Test postcode format if ( ! $ this -> isValidPostcodeFormat ( $ postcode ) ) throw new PostcodeNl_Api_RestClient_InputInvalidException ( 'Postcode `' . $ postcode . '` needs to be in the 1234AB format.' ) ; // Test housenumber format if ( ! ctype_digit ( $ houseNumber ) ) throw new PostcodeNl_Api_RestClient_InputInvalidException ( 'House number `' . $ houseNumber . '` must contain digits only.' ) ; // Use the regular validation function $ url = $ this -> _restApiUrl . '/addresses/postcode/' . rawurlencode ( $ postcode ) . '/' . rawurlencode ( $ houseNumber ) . '/' . rawurlencode ( $ houseNumberAddition ) ; $ response = $ this -> _doRestCall ( $ url ) ; $ this -> _checkResponse ( $ response ) ; // Strictly enforce housenumber addition validity if ( $ validateHouseNumberAddition ) { if ( $ response [ 'data' ] [ 'houseNumberAddition' ] === null ) throw new PostcodeNl_Api_RestClient_InputInvalidException ( 'Housenumber addition `' . $ houseNumberAddition . '` is not known for this address, valid additions are: `' . implode ( '`, `' , $ response [ 'data' ] [ 'houseNumberAdditions' ] ) . '`.' ) ; } // Successful response! return $ response [ 'data' ] ; }
Look up an address by postcode and house number.

@param string $postcode Dutch postcode in the '1234AB' format
@param int|string $houseNumber House number (may contain house number addition, will be separated automatically)
@param string $houseNumberAddition House number addition
@param bool $validateHouseNumberAddition Enable to validate the addition
@return array
@throws PostcodeNl_Api_RestClient_InputInvalidException

@see https://api.postcode.nl/documentation
street - (string) Street name in accordance with "BAG (Basisregistraties adressen en gebouwen)". In capital and lowercase letters, including punctuation marks and accents. This field is at most 80 characters in length. Filled with "Postbus" in case it is a range of PO boxes.
streetNen - (string) Street name in NEN-5825 notation, which has a lower maximum length. In capital and lowercase letters, including punctuation marks and accents. This field is at most 24 characters in length. Filled with "Postbus" in case it is a range of PO boxes.
houseNumber - (int) House number of a 'perceel'. In case of a Postbus match the house number will always be 0. Range: 0-99999
houseNumberAddition - (string|null) Addition of the house number to uniquely define a location. These additions are officially recognized by the municipality. Null if addition not found (see houseNumberAdditions result field).
postcode - (string) Four number neighborhood code (first part of a postcode). Range: 1000-9999 plus two character letter combination (second part of a postcode). Range: "AA"-"ZZ"
city - (string) Official city name in accordance with "BAG (Basisregistraties adressen en gebouwen)". In capital and lowercase letters, including punctuation marks and accents. This field is at most 80 characters in length.
cityShort - (string) City name, shortened to fit a lower maximum length. In capital and lowercase letters, including punctuation marks and accents. This field is at most 24 characters in length.
municipality - (string) Municipality name in accordance with "BAG (Basisregistraties adressen en gebouwen)". In capital and lowercase letters, including punctuation marks and accents. This field is at most 80 characters in length. Examples: "Baarle-Nassau", "'s-Gravenhage", "Haarlemmerliede en Spaarnwoude".
municipalityShort - (string) Municipality name, shortened to fit a lower maximum length. In capital and lowercase letters, including punctuation marks and accents. This field is at most 24 characters in length. Examples: "Baarle-Nassau", "'s-Gravenhage", "Haarlemmerliede c.a.".
province - (string) Official name of the province, correctly cased and with dashes where applicable.
rdX - (int) X coordinate according to Dutch Rijksdriehoeksmeting "(EPSG) 28992 Amersfoort / RD New". Values range from 0 to 300000 meters. Null for PO Boxes.
rdY - (int) Y coordinate according to Dutch Rijksdriehoeksmeting "(EPSG) 28992 Amersfoort / RD New". Values range from 300000 to 620000 meters. Null for PO Boxes.
latitude - (float) Latitude of address. Null for PO Boxes.
longitude - (float) Longitude of address. Null for PO Boxes.
bagNumberDesignationId - (string) Dutch term used in BAG: "nummeraanduiding id".
bagAddressableObjectId - (string) Dutch term used in BAG: "adresseerbaar object id". Unique identification for objects which have 'building', 'house boat site', or 'mobile home site' as addressType.
addressType - (string) Type of address, see reference link
purposes - (array) Array of strings, each indicating an official Dutch 'usage' category, see reference link
surfaceArea - (int) Surface area of object in square meters (all floors). Null for PO Boxes.
houseNumberAdditions - (array) List of all house number additions having the postcode and houseNumber which was input.
Look up an address by postcode and house number .