PHP code example of themarketinglab / pca-predict-api
1. Go to this page and download the library: Download themarketinglab/pca-predict-api 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/ */
themarketinglab / pca-predict-api example snippets
use TheMarketingLab\PCA\CapturePlus\InteractiveFind\Client as FindClient;
use TheMarketingLab\PCA\CapturePlus\InteractiveRetrieve\Client as RetrieveClient;
$serviceKey = 'ABC';
$findClient = new FindClient(new \SoapClient('https://services.postcodeanywhere.co.uk/CapturePlus/Interactive/Find/v2.10/wsdlnew.ws'), $apiKey);
// All parameters are optional apart from search
$params = [
'search' => 'London' // SearchTerm Required
'filter' => 'PostalCodes' // SearchFor
'country' => 'GBR' // Country
'lang' => 'EN', // LanguagePreference
'maxSuggestions' => 7 // MaxSuggestions,
'maxResults' => 100 // MaxResults
];
// This returns an array containing TheMarketingLab\PCA\CapturePlus\InteractiveFind\Result objects
$results = $findClient->find($params);
// Get full address
$retrieveClient = new RetrieveClient(new \SoapClient("https://services.postcodeanywhere.co.uk/CapturePlus/Interactive/Retrieve/v2.10/wsdlnew.ws"), $apiKey);
// This returns an TheMarketingLab\PCA\CapturePlus\InteractiveRetrieve\Address object
$address = $retrieveClient->retrieve($results[0]);