You can get one of two types of result object in response to a query.
The first group is represented by
Zend_Service_Technorati_*ResultSet objects. A result set object
is basically a collection of result objects. It extends the basic
Zend_Service_Technorati_ResultSet class and implements the
SeekableIterator PHP interface. The best way
to consume a result set object is to loop over it with the PHP
foreach() statement.
Example 825. Consuming a result set object
<?php
// create a new Zend_Service_Technorati
// with a valid API_KEY
$technorati = new Zend_Service_Technorati('VALID_API_KEY');
// search Technorati for PHP keyword
// $resultSet is an instance of Zend_Service_Technorati_SearchResultSet
$resultSet = $technorati->search('PHP');
// loop over all result objects
foreach ($resultSet as $result) {
// $result is an instance of Zend_Service_Technorati_SearchResult
}
Because Zend_Service_Technorati_ResultSet implements the
SeekableIterator interface, you can seek a specific result
object using its position in the result collection.
Example 826. Seeking a specific result set object
<?php
// create a new Zend_Service_Technorati
// with a valid API_KEY
$technorati = new Zend_Service_Technorati('VALID_API_KEY');
// search Technorati for PHP keyword
// $resultSet is an instance of Zend_Service_Technorati_SearchResultSet
$resultSet = $technorati->search('PHP');
// $result is an instance of Zend_Service_Technorati_SearchResult
$resultSet->seek(1);
$result = $resultSet->current();
Note
SeekableIterator works as an array and counts positions
starting from index 0. Fetching position number 1 means getting the second result
in the collection.
The second group is represented by special standalone result objects.
Zend_Service_Technorati_GetInfoResult,
Zend_Service_Technorati_BlogInfoResult and
Zend_Service_Technorati_KeyInfoResult act as wrappers for
additional objects, such as Zend_Service_Technorati_Author and
Zend_Service_Technorati_Weblog.
Example 827. Consuming a standalone result object
<?php
// create a new Zend_Service_Technorati
// with a valid API_KEY
$technorati = new Zend_Service_Technorati('VALID_API_KEY');
// get info about weppos author
$result = $technorati->getInfo('weppos');
$author = $result->getAuthor();
echo '<h2>Blogs authored by ' . $author->getFirstName() . " " .
$author->getLastName() . '</h2>';
echo '<ol>';
foreach ($result->getWeblogs() as $weblog) {
echo '<li>' . $weblog->getName() . '</li>';
}
echo "</ol>";
Please read the Zend_Service_Technorati Classes section for further details about response classes.




