Service/Yahoo.php

Show: PublicProtectedPrivateinherited
Table of Contents
Zend Framework
LICENSE This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Service  
Subpackage
Yahoo  
Version
$Id$  

\Zend_Service_Yahoo

Package: Zend_Service\Yahoo
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Properties

>VPropertyprotected\Zend_Rest_Client $_rest
Reference to the REST client
>VPropertypublicstring $appId
Yahoo Developer Application ID
Details
Type
string

Methods

methodpublic__construct(string $appId) : void

Sets the application ID and instantiates the REST client

Parameters
NameTypeDescription
$appIdstring

specified the developer's appid

methodprotected_checkErrors(\DOMDocument $dom) : void
static

Check if response is an error

Parameters
NameTypeDescription
$dom\DOMDocument

DOM Object representing the result XML

Throws
ExceptionDescription
\Zend_Service_ExceptionThrown when the result from Yahoo! is an error
methodprotected_compareOptions(array $options, array $validOptions) : void

Utility function to check for a difference between two arrays.

Parameters
NameTypeDescription
$optionsarray

User specified options

$validOptionsarray

Valid options

Throws
ExceptionDescription
\Zend_Service_Exceptionif difference is found (e.g., unsupported query option)
methodprotected_prepareOptions(string $query, array $options, array $defaultOptions = array()) : array

Prepare options for sending to Yahoo!

Parameters
NameTypeDescription
$querystring

Search Query

$optionsarray

User specified options

$defaultOptionsarray

Required/Default options

Returns
TypeDescription
array
methodprotected_validateImageSearch(array $options) : void

Validate Image Search Options

Parameters
NameTypeDescription
$optionsarray
Throws
ExceptionDescription
\Zend_Service_Exception
methodprotected_validateInArray(string $name, mixed $value, array $array) : void

Check that a named value is in the given array

Parameters
NameTypeDescription
$namestring

Name associated with the value

$valuemixed

Value

$arrayarray

Array in which to check for the value

Throws
ExceptionDescription
\Zend_Service_Exception
methodprotected_validateInlinkDataSearch(array $options) : void

Validate Inlink Data Search Options

Parameters
NameTypeDescription
$optionsarray
Throws
ExceptionDescription
\Zend_Service_Exception
methodprotected_validateLanguage(string $lang) : void

Throws an exception if the chosen language is not supported

Parameters
NameTypeDescription
$langstring

Language code

Throws
ExceptionDescription
\Zend_Service_Exception
methodprotected_validateLocalSearch(array $options) : void

Validate Local Search Options

Parameters
NameTypeDescription
$optionsarray
Throws
ExceptionDescription
\Zend_Service_Exception
methodprotected_validateNewsSearch(array $options) : void

Validate News Search Options

Parameters
NameTypeDescription
$optionsarray
Throws
ExceptionDescription
\Zend_Service_Exception
methodprotected_validatePageDataSearch(array $options) : void

Validate Page Data Search Options

Parameters
NameTypeDescription
$optionsarray
Throws
ExceptionDescription
\Zend_Service_Exception
methodprotected_validateVideoSearch(array $options) : void

Validate Video Search Options

Parameters
NameTypeDescription
$optionsarray
Throws
ExceptionDescription
\Zend_Service_Exception
methodprotected_validateWebSearch(array $options) : void

Validate Web Search Options

Parameters
NameTypeDescription
$optionsarray
Throws
ExceptionDescription
\Zend_Service_Exception
methodpublicgetRestClient() : \Zend_Rest_Client

Returns a reference to the REST client

Returns
TypeDescription
\Zend_Rest_Client
methodpublicimageSearch(string $query, array $options = array()) : \Zend_Service_Yahoo_ImageResultSet

Perform a search of images. The most basic query consists simply of a plain text search, but you can also specify the type of image, the format, color, etc.

The specific options are: 'type' => (all|any|phrase) How to parse the query terms 'results' => int How many results to return, max is 50 'start' => int The start offset for search results 'format' => (any|bmp|gif|jpeg|png) The type of images to search for 'coloration' => (any|color|bw) The coloration of images to search for 'adult_ok' => bool Flag to allow 'adult' images.
Parameters
NameTypeDescription
$querystring

the query to be run

$optionsarray

an optional array of query options

Returns
TypeDescription
\Zend_Service_Yahoo_ImageResultSetthe search results
Throws
ExceptionDescription
\Zend_Service_Exception
methodpublicinlinkDataSearch(string $query, array $options = array()) : \Zend_Service_Yahoo_ResultSet

Retrieve Inlink Data from siteexplorer.yahoo.com. A basic query consists simply of a URL. Additional options that can be specified consist of: 'results' => int How many results to return, max is 100 'start' => int The start offset for search results 'entire_site' => bool Data for the whole site or a single page 'omit_inlinks' => (none|domain|subdomain) Filter inlinks from these sources

Parameters
NameTypeDescription
$querystring

the query being run

$optionsarray

any optional parameters

Returns
TypeDescription
\Zend_Service_Yahoo_ResultSetThe return set
Throws
ExceptionDescription
\Zend_Service_Exception
methodpubliclocalSearch(string $query, array $options = array()) : \Zend_Service_Yahoo_LocalResultSet

Perform a search on local.yahoo.com. The basic search consists of a query and some fragment of location information; for example zipcode, latitude/longitude, or street address.

Query options include: 'results' => int How many results to return, max is 50 'start' => int The start offset for search results 'sort' => (relevance|title|distance|rating) How to order your results 'radius' => float The radius (in miles) in which to search 'longitude' => float The longitude of the location to search around 'latitude' => float The latitude of the location to search around 'zip' => string The zipcode to search around 'street' => string The street address to search around 'city' => string The city for address search 'state' => string The state for address search 'location' => string An adhoc location string to search around
Parameters
NameTypeDescription
$querystring

The query string you want to run

$optionsarray

The search options, including location

Returns
TypeDescription
\Zend_Service_Yahoo_LocalResultSetThe results
Throws
ExceptionDescription
\Zend_Service_Exception
methodpublicnewsSearch(string $query, array $options = array()) : \Zend_Service_Yahoo_NewsResultSet

Execute a search on news.yahoo.com. This method minimally takes a text query to search on.

Query options coonsist of: 'results' => int How many results to return, max is 50 'start' => int The start offset for search results 'sort' => (rank|date) How to order your results 'language' => lang The target document language to match 'type' => (all|any|phrase) How the query should be parsed 'site' => string A site to which your search should be restricted
Parameters
NameTypeDescription
$querystring

The query to run

$optionsarray

The array of optional parameters

Returns
TypeDescription
\Zend_Service_Yahoo_NewsResultSetThe query return set
Throws
ExceptionDescription
\Zend_Service_Exception
methodpublicpageDataSearch(string $query, array $options = array()) : \Zend_Service_Yahoo_ResultSet

Retrieve Page Data from siteexplorer.yahoo.com. A basic query consists simply of a URL. Additional options that can be specified consist of: 'results' => int How many results to return, max is 100 'start' => int The start offset for search results 'domain_only' => bool Data for just the given domain or all sub-domains also

Parameters
NameTypeDescription
$querystring

the query being run

$optionsarray

any optional parameters

Returns
TypeDescription
\Zend_Service_Yahoo_ResultSetThe return set
Throws
ExceptionDescription
\Zend_Service_Exception
methodpublicvideoSearch(string $query, array $options = array()) : \Zend_Service_Yahoo_VideoResultSet

Perform a search of videos. The most basic query consists simply of a plain text search, but you can also specify the format of video.

The specific options are: 'type' => (all|any|phrase) How to parse the query terms 'results' => int How many results to return, max is 50 'start' => int The start offset for search results 'format' => (any|avi|flash|mpeg|msmedia|quicktime|realmedia) The type of videos to search for 'adult_ok' => bool Flag to allow 'adult' videos.
Parameters
NameTypeDescription
$querystring

the query to be run

$optionsarray

an optional array of query options

Returns
TypeDescription
\Zend_Service_Yahoo_VideoResultSetthe search results
Throws
ExceptionDescription
\Zend_Service_Exception
methodpublicwebSearch(string $query, array $options = array()) : \Zend_Service_Yahoo_WebResultSet

Perform a web content search on search.yahoo.com. A basic query consists simply of a text query. Additional options that can be specified consist of: 'results' => int How many results to return, max is 50 'start' => int The start offset for search results 'language' => lang The target document language to match 'type' => (all|any|phrase) How the query should be parsed 'site' => string A site to which your search should be restricted 'format' => (any|html|msword|pdf|ppt|rss|txt|xls) 'adult_ok' => bool permit 'adult' content in the search results 'similar_ok' => bool permit similar results in the result set 'country' => string The country code for the content searched 'license' => (any|cc_any|cc_commercial|cc_modifiable) The license of content being searched 'region' => The regional search engine on which the service performs the search. default us.

Parameters
NameTypeDescription
$querystring

the query being run

$optionsarray

any optional parameters

Returns
TypeDescription
\Zend_Service_Yahoo_WebResultSetThe return set
Throws
ExceptionDescription
\Zend_Service_Exception
Documentation was generated by phpDocumentor 2.2.0 .