Zend_Service_YahooIntroductionZend_Service_Yahoo is a simple API for using many of the Yahoo! REST APIs.
Zend_Service_Yahoo allows you to search Yahoo! Web search, Yahoo! News, Yahoo! Local, Yahoo!
Images. In order to use the Yahoo! REST API, you must have a Yahoo! Application ID. To obtain an Application ID, please complete and submit the
Application ID Request Form.
Searching the Web with Yahoo!Zend_Service_Yahoo enables you to search the Web with Yahoo! using the
webSearch() method, which accepts a string query parameter and an optional second parameter
as an array of search options. For full details and an option list, please visit the
Yahoo! Web Search
Documentation. The webSearch() method returns a
Zend_Service_Yahoo_WebResultSet object.
Searching the Web with Yahoo!webSearch('PHP');
foreach ($results as $result) {
echo $result->Title .' ';
}
]]>Finding Images with Yahoo!
You can search for Images with Yahoo using Zend_Service_Yahoo's imageSearch()
method. This method accepts a string query parameter and an optional array of search options, as for the
webSearch() method. For full details
and an option list, please visit the
Yahoo! Image Search
Documentation.
Finding Images with Yahoo!imageSearch('PHP');
foreach ($results as $result) {
echo $result->Title .' ';
}
]]>Finding videos with Yahoo!
You can search for videos with Yahoo using Zend_Service_Yahoo's videoSearch()
method. For full details and an option list, please visit the
Yahoo! Video Search
Documentation.
Finding videos with Yahoo!videoSearch('PHP');
foreach ($results as $result) {
echo $result->Title .' ';
}
]]>Finding Local Businesses and Services with Yahoo!
You can search for local businesses and services with Yahoo! by using the localSearch() method.
For full details, please see the
Yahoo! Local Search
Documentation.
Finding Local Businesses and Services with Yahoo!localSearch('Apple Computers', array('zip' => '95014'));
foreach ($results as $result) {
echo $result->Title .' ';
}
]]>Searching Yahoo! News
Searching Yahoo! News is simple; just use the newsSearch() method, as in the following
example. For full details, please see the
Yahoo! News Search
Documentation.
Searching Yahoo! NewsnewsSearch('PHP');
foreach ($results as $result) {
echo $result->Title .' ';
}
]]>Searching Yahoo! Site Explorer Inbound Links
Searching Yahoo! Site Explorer Inbound Links is simple; just use the inlinkDataSearch()
method, as in the following example. For full details, please see the
Yahoo!
Site Explorer Inbound Links Documentation.
Searching Yahoo! Site Explorer Inbound LinksinlinkDataSearch('http://framework.zend.com/');
foreach ($results as $result) {
echo $result->Title .' ';
}
]]>Searching Yahoo! Site Explorer's PageData
Searching Yahoo! Site Explorer's PageData is simple; just use the pageDataSearch()
method, as in the following example. For full details, please see the
Yahoo!
Site Explorer PageData Documentation.
Searching Yahoo! Site Explorer's PageDatapageDataSearch('http://framework.zend.com/');
foreach ($results as $result) {
echo $result->Title .' ';
}
]]>Zend_Service_Yahoo Classes
The following classes are all returned by the various Yahoo! searches. Each search type returns a
type-specific result set which can be easily iterated, with each result being contained in a type result
object. All result set classes implement the SeekableIterator interface, allowing for easy
iteration and seeking to a specific result.
Zend_Service_Yahoo_ResultSetZend_Service_Yahoo_WebResultSetZend_Service_Yahoo_ImageResultSetZend_Service_Yahoo_VideoResultSetZend_Service_Yahoo_LocalResultSetZend_Service_Yahoo_NewsResultSetZend_Service_Yahoo_InlinkDataResultSetZend_Service_Yahoo_PageDataResultSetZend_Service_Yahoo_ResultZend_Service_Yahoo_WebResultZend_Service_Yahoo_ImageResultZend_Service_Yahoo_VideoResultZend_Service_Yahoo_LocalResultZend_Service_Yahoo_NewsResultZend_Service_Yahoo_InlinkDataResultZend_Service_Yahoo_PageDataResultZend_Service_Yahoo_ImageZend_Service_Yahoo_ResultSet
Each of the search specific result sets is extended from this base class.
Each of the specific result sets returns a search specific
Zend_Service_Yahoo_Result objects.
Zend_Service_Yahoo_ResultSet::totalResults()inttotalResults
Returns the number of results returned for the search.
Properties
Zend_Service_Yahoo_ResultSetNameTypeDescriptiontotalResultsAvailableint
Total number of results found.
totalResultsReturnedintNumber of results in the current result setfirstResultPositionintPosition of the first result in this set relative to the total number of results.
Back to Class List
Zend_Service_Yahoo_WebResultSetZend_Service_Yahoo_WebResultSet represents a Yahoo! Web Search result set.
Zend_Service_Yahoo_WebResultSet extends Zend_Service_Yahoo_ResultSet
Back to Class List
Zend_Service_Yahoo_ImageResultSetZend_Service_Yahoo_ImageResultSet represents a Yahoo! Image Search result set.
Zend_Service_Yahoo_ImageResultSet extends Zend_Service_Yahoo_ResultSet
Back to Class List
Zend_Service_Yahoo_VideoResultSetZend_Service_Yahoo_VideoResultSet represents a Yahoo! Video Search result set.
Zend_Service_Yahoo_VideoResultSet extends Zend_Service_Yahoo_ResultSet
Back to Class List
Zend_Service_Yahoo_LocalResultSetZend_Service_Yahoo_LocalResultSet represents a Yahoo! Local Search result set.
Zend_Service_Yahoo_LocalResultSet PropertiesNameTypeDescriptionresultSetMapURLstringThe URL of a webpage containing a map graphic with all returned results plotted on it.
Zend_Service_Yahoo_LocalResultSet extends Zend_Service_Yahoo_ResultSet
Back to Class List
Zend_Service_Yahoo_NewsResultSetZend_Service_Yahoo_NewsResultSet represents a Yahoo! News Search result set.
Zend_Service_Yahoo_NewsResultSet extends Zend_Service_Yahoo_ResultSet
Back to Class List
Zend_Service_Yahoo_InlinkDataResultSetZend_Service_Yahoo_InlinkDataResultSet represents a Yahoo! Inbound Link Search result set.
Zend_Service_Yahoo_InlinkDataResultSet extends Zend_Service_Yahoo_ResultSet
Back to Class List
Zend_Service_Yahoo_PageDataResultSetZend_Service_Yahoo_PageDataResultSet represents a Yahoo! PageData Search result set.
Zend_Service_Yahoo_PageDataResultSet extends Zend_Service_Yahoo_ResultSet
Back to Class List
Zend_Service_Yahoo_Result
Each of the search specific results is extended from this base class.
Properties
Zend_Service_Yahoo_Result PropertiesNameTypeDescriptionTitlestringTitle of the Result itemUrlstringThe URL of the result itemClickUrlstringThe URL for linking to the result item
Back to Class List
Zend_Service_Yahoo_WebResult
Each Web Search result is returned as a Zend_Service_Yahoo_WebResult object.
Properties
Zend_Service_Yahoo_WebResult PropertiesNameTypeDescriptionSummarystringResult summaryMimeTypestringResult MIME typeModificationDatestringThe last modification date of the result as a UNIX timestamp.CacheUrlstringYahoo! web cache URL for the result, if it exists.CacheSizeintThe size of the Cache entry
Back to Class List
Zend_Service_Yahoo_ImageResult
Each Image Search result is returned as a Zend_Service_Yahoo_ImageResult object.
Properties
Zend_Service_Yahoo_ImageResult PropertiesNameTypeDescriptionSummarystringResult summaryRefererUrlstringThe URL of the page which contains the imageFileSizeintThe size of the image file in bytesFileFormatstringThe format of the image (bmp, gif, jpeg, png, etc.)HeightintThe height of the imageWidthintThe width of the imageThumbnailZend_Service_Yahoo_ImageImage thumbnail
Back to Class List
Zend_Service_Yahoo_VideoResult
Each Video Search result is returned as a Zend_Service_Yahoo_VideoResult object.
Properties
Zend_Service_Yahoo_VideoResult PropertiesNameTypeDescriptionSummarystringResult summaryRefererUrlstringThe URL of the page which contains the videoFileSizeintThe size of the video file in bytesFileFormatstringThe format of the video (avi, flash, mpeg, msmedia, quicktime, realmedia, etc.)HeightintThe height of the video in pixelsWidthintThe width of the video in pixelsDurationintThe length of the video in secondsChannelsintNumber of audio channels in the videoStreamingbooleanWhether the video is streaming or notThumbnailZend_Service_Yahoo_ImageImage thumbnail
Back to Class List
Zend_Service_Yahoo_LocalResult
Each Local Search result is returned as a Zend_Service_Yahoo_LocalResult object.
Properties
Zend_Service_Yahoo_LocalResult PropertiesNameTypeDescriptionAddressstringStreet Address of the resultCitystringCity in which the result resides inStatestringState in which the result resides inPhonestringPhone number for the resultRatingintUser submitted rating for the resultDistancefloatThe distance to the result from your specified locationMapUrlstringA URL of a map for the resultBusinessUrlstringThe URL for the business website, if knownBusinessClickUrlstringThe URL for linking to the business website, if known
Back to Class List
Zend_Service_Yahoo_NewsResult
Each News Search result is returned as a Zend_Service_Yahoo_NewsResult object.
Properties
Zend_Service_Yahoo_NewsResult PropertiesNameTypeDescriptionSummarystringResult summaryNewsSourcestringThe company who distributed the articleNewsSourceUrlstringThe URL for the company who distributed the articleLanguagestringThe language the article is inPublishDatestringThe date the article was published as a UNIX timestampModificationDatestringThe date the article was last modified as a UNIX timestampThumbnailZend_Service_Yahoo_ImageImage Thumbnail for the article, if it exists
Back to Class List
Zend_Service_Yahoo_InlinkDataResult
Each Inbound Link Search result is returned as a
Zend_Service_Yahoo_InlinkDatabResult object.
Back to Class List
Zend_Service_Yahoo_PageDataResult
Each Page Data Search result is returned as a
Zend_Service_Yahoo_PageDatabResult object.
Back to Class List
Zend_Service_Yahoo_Image
All images returned either by the Yahoo! Image Search or the Yahoo! News Search
are represented by Zend_Service_Yahoo_Image objects
Properties