PHP code example of freshheads / postcode-api-client
1. Go to this page and download the library: Download freshheads/postcode-api-client 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/ */
freshheads / postcode-api-client example snippets
// Use the composer autoloader to load dependencies
n_api_key';
// In this example we made use of the Guzzle as HTTPClient.
$client = new \FH\PostcodeAPI\Client(
new GuzzleHttp\Client([
'headers' => [
'X-Api-Key' => $apiKey
]
])
);
// call endpoints
$response = $client->getAddresses('5041EB', 21);
$response = $client->getAddress('0855200000061001');
$response = $client->getPostcodeDataByPostcode('5041EB');
// Note that this call is only available with a premium account
$response = $client->getPostcodes('51.566405', '5.077171');