Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.0.3
-
Fix Version/s: 1.9.5
-
Component/s: Zend_Service_Yahoo
-
Labels:None
-
Fix Version Priority:Should Have
Description
The 'site' option of Zend_Service_Yahoo::webSearch does not work. Whenever it is specified, nothing is returned.
For example, when searching for "mysql" on "www.php.net", many results are returned:
Similarly, calling the REST API directly returns results:
However, doing the same with "Zend Framework 1.0.3", nothing is returned.
Using PEAR's Services_Yahoo_Search component, the results are returned correctly.
Sample Code:
// ---------------------------------------------------------------------- // Zend Framework 1.0.3 include_once 'Zend/Service/Yahoo.php'; $yahoo = new Zend_Service_Yahoo('YAHOO_ID'); $results = $yahoo->webSearch('mysql', array('site' => 'www.php.net')); foreach ($results as $result) { echo $result->Title . '<br />'; } echo "<hr />"; // ---------------------------------------------------------------------- // PEAR include_once 'Services/Yahoo/Search.php'; $yahoo = Services_Yahoo_Search::factory('web'); $yahoo->setAppId('YAHOO_ID'); $yahoo->setSites(array('www.php.net')); $yahoo->setQuery('mysql'); $results = $yahoo->submit(); foreach ($results as $result) { echo $result['Title'] . '<br />'; }
I investigated the issue.
Here's a few notes:
This is the URI queried by Zend_Service_Yahoo
http://search.yahooapis.com/WebSearchService/V1/webSearch?type=all&start=1&language=en&license=any&results=10&format=any&site=www.php.net&appid=API_KEY&query=mysql
I tried to remove each default parameter and I discovered license parameter can cause some problem when site is not empty, even if any is the default value.
I would suggest to remove the default value and left the parameter empty.