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

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:

<?php
$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
    
print_r($result);

    
// or just the firm name
    
echo $result->firm;

    
// valid address?
    
$valid = ($result->valid == 'VALID');
}

Zend Framework