PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Making Your First Query

Once you have used the getService() method to get a client for a particular StrikeIron service, you can utilize that client by calling methods on it just like any other PHP object.

<?php
$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' => 'ontario'));
echo 
$rateInfo->province;
echo 
$rateInfo->abbreviation;
echo 
$rateInfo->GST;

In the example above, the getService() method is used to return a client to the Sales & Use Tax Basic service. The client object is stored in $taxBasic.

The getTaxRateCanada() method is then called on the service. An associative array is used to supply keyword parameters to the method. This is the way that all StrikeIron methods are called.

The result from getTaxRateCanada() is stored in $rateInfo and has properties like province and GST.

Many of the StrikeIron services are as simple to use as the example above. See Bundled Services for detailed information on three StrikeIron services.

Zend Framework