Source for file AbstractSearch.php
Documentation is available at AbstractSearch.php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
* Copyright 2005-2006 Martin Jansen
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* @package Services_Yahoo
* @author Martin Jansen <mj@php.net>
* @copyright 2005-2006 Martin Jansen
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* @version CVS: $Id: AbstractSearch.php,v 1.11 2006/10/04 13:30:31 mj Exp $
* @link http://pear.php.net/package/Services_Yahoo
require_once "Services/Yahoo/Search/Response.php";
require_once "HTTP/Request.php";
* This abstract class serves as the base class for all different
* types of searches that available through Services_Yahoo.
* @package Services_Yahoo
* @author Martin Jansen <mj@php.net>
* @copyright 2005-2006 Martin Jansen
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* @version CVS: $Id: AbstractSearch.php,v 1.11 2006/10/04 13:30:31 mj Exp $
* @link http://pear.php.net/package/Services_Yahoo
protected $parameters = array ("appid" => "PEAR_Services_Yahoo", "output" => "php");
* This method submits the search and handles the response. It
* returns an instance of Services_Yahoo_Result which may be used
* to further make use of the result.
* @return object Services_Yahoo_Response Search result
* @throws Services_Yahoo_Exception
$url = $this->requestURL . "?";
foreach ($value as $value2) {
$url .= $key . "=" . urlencode($value2) . "&";
$url .= $key . "=" . urlencode($value) . "&";
$request = new HTTP_Request ($url);
$result = $request->sendRequest ();
if (PEAR ::isError ($result)) {
* Set Application ID for the search
* An Application ID is a string that uniquely identifies your
* application. Think of it as like a User-Agent string. If you
* have multiple applications, you should use a different ID for
* each one. You can register your ID and make sure nobody is
* already using your ID on Yahoo's Application ID registration
* The ID defaults to "PEAR_Services_Yahoo", but you are free to
* change it to whatever you want. Please note that the access
* to the Yahoo API is not limited via the Application ID but via
* the IP address of the host where the package is used.
* @link http://api.search.yahoo.com/webservices/register_application
* @link http://developer.yahoo.net/documentation/rate.html
* @param string Application ID
* @return Services_Yahoo_AbstractSearch Object which contains the method
* Set the kind of search to submit
* The allowed values of the parameter depend on the search
* type. If unsure, please consult Yahoo's documentation at
* http://developer.yahoo.net/.
* Even if not all searches support this parameter, it is common
* enough to be part of the abstract base class.
* @param string Kind of search
* @return Services_Yahoo_AbstractSearch Object which contains the method
* Set the number of results to return.
* Even if not all searches support this parameter, it is common
* enough to be part of the abstract base class.
* @param int Number of results
* @return Services_Yahoo_AbstractSearch Object which contains the method
if ($count > 50 || $count < 0 ) {
* Set the starting result position to return (1-based)
* Even if not all searches support this parameter, it is common
* enough to be part of the abstract base class.
* @param int Starting position
* @return Services_Yahoo_AbstractSearch Object which contains the method
* Set the format to search for
* The allowed values of the parameter depend on the search
* type. If unsure, please consult Yahoo's documentation at
* http://developer.yahoo.net/.
* Even if not all searches support this parameter, it is common
* enough to be part of the abstract base class.
* @param string Format of search
* @return Services_Yahoo_AbstractSearch Object which contains the method
* Set that the results will include adult content
* Even if not all searches support this parameter, it is common
* enough to be part of the abstract base class.
* @return Services_Yahoo_AbstractSearch Object which contains the method
Documentation generated on Fri, 20 Apr 2007 14:30:05 -0400 by phpDocumentor 1.3.0. PEAR Logo Copyright © PHP Group 2004.
|