themarketinglab / pca-predict-api
与 PCA Predict API 交互的客户端
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-09-14 19:09:32 UTC
README
服务
目前实现的功能:- CapturePlus Interactive Find (v2.10) - CapturePlus Interactive Retrieve (v2.10)
安装
此包在 packagist.org 上可用
composer require themarketinglab/pca-predict-api
使用方法
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]);