Zend_Service_StrikeIron_ZipCodeInfo provides a client for
StrikeIron's Zip Code Information Service. For more information on this service, visit
these StrikeIron resources:
The service contains a getZipCode() method that will retrieve
information about a United States ZIP code or Canadian postal code:
<?php
$strikeIron = new Zend_Service_StrikeIron(array('username' => 'your-username',
'password' => 'your-password'));
// Get a client for the Zip Code Information service
$zipInfo = $strikeIron->getService(array('class' => 'ZipCodeInfo'));
// Get the Zip information for 95014
$response = $zipInfo->getZipCode(array('ZipCode' => 95014));
$zips = $response->serviceResult;
// Display the results
if ($zips->count == 0) {
echo 'No results found';
} else {
// a result with one single zip code is returned as an object,
// not an array with one element as one might expect.
if (! is_array($zips->zipCodes)) {
$zips->zipCodes = array($zips->zipCodes);
}
// print all of the possible results
foreach ($zips->zipCodes as $z) {
$info = $z->zipCodeInfo;
// show all properties
print_r($info);
// or just the city name
echo $info->preferredCityName;
}
}
// Detailed status information
// http://www.strikeiron.com/exampledata/StrikeIronZipCodeInformation_v3.pdf
$status = $response->serviceStatus;




