當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Uri_Http::setHost方法代碼示例

本文整理匯總了PHP中Zend_Uri_Http::setHost方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Uri_Http::setHost方法的具體用法?PHP Zend_Uri_Http::setHost怎麽用?PHP Zend_Uri_Http::setHost使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend_Uri_Http的用法示例。


在下文中一共展示了Zend_Uri_Http::setHost方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: webSearch

 /**
  * 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
  *
  * @param string $query  the query being run
  * @param array $options  any optional parameters
  * @return Zend_Service_Yahoo_WebResultSet  The return set
  */
 public function webSearch($query, $options = NULL)
 {
     static $default_options = array('type' => 'all', 'start' => 1, 'language' => 'en', 'license' => 'any', 'results' => 10, 'format' => 'any');
     $options = $this->_prepareOptions($query, $options, $default_options);
     $this->_validateWebSearch($options);
     $this->_uri->setHost('api.search.yahoo.com');
     $response = $this->restGet('/WebSearchService/V1/webSearch', $options);
     if ($response->isError()) {
         throw new Zend_Service_Exception('An error occurred sending request. Status code: ' . $response->getStatus());
     }
     $dom = new DOMDocument();
     $dom->loadXML($response->getBody());
     self::_checkErrors($dom);
     return new Zend_Service_Yahoo_WebResultSet($dom);
 }
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:34,代碼來源:Yahoo.php


注:本文中的Zend_Uri_Http::setHost方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。