themarketinglab / pca-predict-api
Client for interacting with the PCA Predict APIs
v1.0.1
2016-12-16 09:57 UTC
Requires
- symfony/options-resolver: ^2.8
Requires (Dev)
- phpspec/phpspec: ^3.0
- phpunit/phpunit: ^5.4
This package is not auto-updated.
Last update: 2024-12-21 20:41:35 UTC
README
Services
It currently implements: - CapturePlus Interactive Find (v2.10) - CapturePlus Interactive Retrieve (v2.10)
Installation
The package is available on packagist.org
composer require themarketinglab/pca-predict-api
Usage
CapturePlus Interactive
<?php
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]);