Zend_Service_StrikeIron: Bundled Services
Zend_Service_StrikeIron comes with wrapper classes for three popular
StrikeIron services.
U.S. Address Verification
Zend_Service_StrikeIron_USAddressVerification provides a client
for StrikeIron's U.S. Address Verification Service. For more information on this
service, visit these StrikeIron resources:
The service contains a verifyAddressUSA() method that will
verify an address in the United States:
$strikeIron =
new Zend_Service_StrikeIron
(array('username' =>
'your-username',
'password' => 'your-password'));
// Get a client for the Zip Code Information service
$verifier =
$strikeIron->
getService(array('class' =>
'USAddressVerification'));
// Address to verify. Not all fields are required but
// supply as many as possible for the best results.
$address =
array('firm' =>
'Zend Technologies',
'addressLine1' => '19200 Stevens Creek Blvd',
'addressLine2' => '',
'city_state_zip' => 'Cupertino CA 95014');
// Verify the address
$result = $verifier->verifyAddressUSA($address);
// Display the results
if ($result->addressErrorNumber != 0) {
echo $result->
addressErrorNumber;
echo $result->
addressErrorMessage;
} else {
// show all properties
// or just the firm name
// valid address?
$valid = ($result->valid == 'VALID');
}
Sales & Use Tax Basic
Zend_Service_StrikeIron_SalesUseTaxBasic provides a client for
StrikeIron's Sales & Use Tax Basic service. For more information on this
service, visit these StrikeIron resources:
The service contains two methods, getTaxRateUSA() and
getTaxRateCanada(), that will retrieve sales and use tax data
for the United States and Canada, respectively.
$strikeIron =
new Zend_Service_StrikeIron
(array('username' =>
'your-username',
'password' => 'your-password'));
// Get a client for the Sales & Use Tax Basic service
$taxBasic =
$strikeIron->
getService(array('class' =>
'SalesUseTaxBasic'));
// Query tax rate for Ontario, Canada
$rateInfo =
$taxBasic->
getTaxRateCanada(array('province' =>
'foo'));
print_r($rateInfo);
// show all properties
echo $rateInfo->
GST;
// or just the GST (Goods & Services Tax)
// Query tax rate for Cupertino, CA USA
$rateInfo =
$taxBasic->
getTaxRateUS(array('zip_code' =>
95014));
print_r($rateInfo);
// show all properties
echo $rateInfo->
state_sales_tax;
// or just the state sales tax