| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583 |
- <sect1 id="zend.service.yahoo">
- <title>Zend_Service_Yahoo</title>
- <sect2 id="zend.service.yahoo.introduction">
- <title>简介</title>
- <para>
- <code>Zend_Service_Yahoo</code> 是一个实现多个Yahoo! REST 接口的API.
- <code>Zend_Service_Yahoo</code> 允许你使用Yahoo! 网页搜索, Yahoo! 新闻,
- Yahoo! 本地(Local), Yahoo! 图片. 为了使用 Yahoo! REST API,
- 你必须拥有一个 Yahoo! Application ID. 要获得它, 请访问
- <ulink url="http://api.search.yahoo.com/webservices/register_application">Application ID Request Form</ulink>.
- </para>
- </sect2>
- <sect2 id="zend.service.yahoo.websearch">
- <title>用Yahoo!来搜索网页</title>
- <para>
- <code>Zend_Service_Yahoo</code> 允许你用
- <code>webSearch()</code> 方法来进行Yahoo! 网页搜索, 它接受一个查询字符串作为参数 ,
- 用一个可选的数组传递搜索选项. 更多的细节和搜索选项的信息, 请访问
- <ulink url="http://developer.yahoo.net/search/web/V1/webSearch.html">Yahoo! Web Search
- Documentation</ulink>. <code>webSearch()</code> 方法返回一个
- <code>Zend_Service_Yahoo_WebResultSet</code> 对象.
- </para>
- <example>
- <title>用Yahoo!来搜索网页</title>
- <programlisting><![CDATA[<?php
- require_once 'Zend/Service/Yahoo.php';
- $yahoo = new Zend_Service_Yahoo("YAHOO_APPLICATION_ID");
- $results = $yahoo->webSearch('PHP');
- foreach ($results as $result) {
- echo $result->Title .'<br />';
- }
- ?>]]> </programlisting>
- </example>
- </sect2>
- <sect2 id="zend.service.yahoo.imagesearch">
- <title> 用Yahoo!来查找图片</title>
- <para>
- 你可以使用<code>Zend_Service_Yahoo</code>的 <code>imageSearch()</code>
- 方法来在Yahoo上搜索图片。 。 它接受一个查询字符串作为参数 ,用一个可选的数组传递搜索选项, 就像
- <link linkend="zend.service.yahoo.websearch"><code>webSearch()</code> method</link>.
- 更多的细节和搜索选项的信息, 请访问
- <ulink url="http://developer.yahoo.net/search/image/V1/imageSearch.html">Yahoo! Image Search
- Documentation</ulink>.
- </para>
- <example>
- <title>用Yahoo!来查找图片</title>
- <programlisting><![CDATA[<?php
- require_once 'Zend/Service/Yahoo.php';
- $yahoo = new Zend_Service_Yahoo("YAHOO_APPLICATION_ID");
- $results = $yahoo->imageSearch('PHP');
- foreach ($results as $result) {
- echo $result->Title .'<br />';
- }
- ?>]]> </programlisting>
- </example>
- </sect2>
- <sect2 id="zend.service.yahoo.localsearch">
- <title>Finding Local Businesses and Services with Yahoo!</title>
- <para>
- You can search for local businesses and services with Yahoo! by using the <code>localSearch()</code> method.
- For full details, please see the
- <ulink url="http://developer.yahoo.net/search/local/V1/localSearch.html">Yahoo! Local Search
- Documentation</ulink>.
- </para>
- <example>
- <title>用Yahoo!查找本地商务和服务信息</title>
- <programlisting><![CDATA[<?php
- require_once 'Zend/Service/Yahoo.php';
- $yahoo = new Zend_Service_Yahoo("YAHOO_APPLICATION_ID");
- $results = $yahoo->localSearch('Apple Computers', array('zip' => '95014'));
- foreach ($results as $result) {
- echo $result->Title .'<br />';
- }
- ?>]]> </programlisting>
- </example>
- </sect2>
- <sect2 id="zend.service.yahoo.newssearch">
- <title>搜索Yahoo! 新闻</title>
- <para>
- 搜索Yahoo! 新闻非常简单; 使用 <code>newsSearch()</code> 方法,
- 如下面的例子. 更多的细节和搜索选项的信息, 请访问
- <ulink url="http://developer.yahoo.net/search/news/V1/newsSearch.html">Yahoo! News Search
- Documentation</ulink>.
- </para>
- <example>
- <title>搜索Yahoo! 新闻</title>
- <programlisting><![CDATA[<?php
- require_once 'Zend/Service/Yahoo.php';
- $yahoo = new Zend_Service_Yahoo("YAHOO_APPLICATION_ID");
- $results = $yahoo->newsSearch('PHP');
- foreach ($results as $result) {
- echo $result->Title .'<br />';
- }
- ?>]]> </programlisting>
- </example>
- </sect2>
- <sect2 id="zend.service.yahoo.classes">
- <title>Zend_Service_Yahoo 类</title>
- <para>
- 不同的Yahoo! 搜索类型会返回下面的这些类. 每个搜索类型返回指定类型的结果集, 我们可以很方便的对它们进行遍历,
- 每个结果被包含在一种类型的结果集对象中. 所有这些对象都实现了
- <code>SeekableIterator</code> 接口, 可以很容易的进行遍历和寻找指定结果。
- <itemizedlist>
- <listitem><para><link linkend="zend.service.yahoo.classes.resultset"><code>Zend_Service_Yahoo_ResultSet</code></link></para></listitem>
- <listitem><para><link linkend="zend.service.yahoo.classes.webresultset"><code>Zend_Service_Yahoo_WebResultSet</code></link></para></listitem>
- <listitem><para><link linkend="zend.service.yahoo.classes.imageresultset"><code>Zend_Service_Yahoo_ImageResultSet</code></link></para></listitem>
- <listitem><para><link linkend="zend.service.yahoo.classes.localresultset"><code>Zend_Service_Yahoo_LocalResultSet</code></link></para></listitem>
- <listitem><para><link linkend="zend.service.yahoo.classes.newsresultset"><code>Zend_Service_Yahoo_NewsResultSet</code></link></para></listitem>
- <listitem><para><link linkend="zend.service.yahoo.classes.result"><code>Zend_Service_Yahoo_Result</code></link></para></listitem>
- <listitem><para><link linkend="zend.service.yahoo.classes.webresult"><code>Zend_Service_Yahoo_WebResult</code></link></para></listitem>
- <listitem><para><link linkend="zend.service.yahoo.classes.imageresult"><code>Zend_Service_Yahoo_ImageResult</code></link></para></listitem>
- <listitem><para><link linkend="zend.service.yahoo.classes.localresult"><code>Zend_Service_Yahoo_LocalResult</code></link></para></listitem>
- <listitem><para><link linkend="zend.service.yahoo.classes.newsresult"><code>Zend_Service_Yahoo_NewsResult</code></link></para></listitem>
- <listitem><para><link linkend="zend.service.yahoo.classes.image"><code>Zend_Service_Yahoo_Image</code></link></para></listitem>
- </itemizedlist>
- </para>
- <sect3 id="zend.service.yahoo.classes.resultset">
- <title>Zend_Service_Yahoo_ResultSet</title>
- <para>
- 每类搜索特定的结果集都由这个基类扩展而成
- </para>
- <para>
- 每类搜索特定的结果集都会返回这个搜索特定的
- <link linkend="zend.service.yahoo.classes.result">Zend_Service_Yahoo_Result</link> 对象.
- </para>
- <sect4 id="zend.service.yahoo.classes.resultset.totalResults">
- <title>Zend_Service_Yahoo_ResultSet::totalResults()</title>
- <para>
- <methodsynopsis>
- <type>int</type>
- <methodname>totalResults</methodname>
- <void />
- </methodsynopsis>
- </para>
- <para>
- 返回搜索结果的数量
- </para>
- </sect4>
- <sect4 id="zend.service.yahoo.classes.resultset.properties">
- <title>Properties</title>
- <table>
- <title>Zend_Service_Yahoo_ResultSet</title>
- <tgroup cols="3">
- <thead>
- <row>
- <entry>名称</entry>
- <entry>类型</entry>
- <entry>描述</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>totalResultsAvailable</entry>
- <entry>int</entry>
- <entry>
- 所有找到的结果的数量
- </entry>
- </row>
- <row>
- <entry>totalResultsReturned</entry>
- <entry>int</entry>
- <entry>当前结果集中结果的数量</entry>
- </row>
- <row>
- <entry>firstResultPosition</entry>
- <entry>int</entry>
- <entry>当前结果集中的第一条在所有结果中的相对位置</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <para>
- <link linkend="zend.service.yahoo.classes">Back to Class List</link>
- </para>
- </sect4>
- </sect3>
- <sect3 id="zend.service.yahoo.classes.webresultset">
- <title>Zend_Service_Yahoo_WebResultSet</title>
- <para>
- <code>Zend_Service_Yahoo_WebResultSet</code> 代表 Yahoo! 网页搜索的结果集.
- </para>
- <note>
- <para>
- <code>Zend_Service_Yahoo_WebResultSet</code> 扩展自 <link linkend="zend.service.yahoo.classes.resultset">Zend_Service_Yahoo_ResultSet</link>
- </para>
- </note>
- <para>
- <link linkend="zend.service.yahoo.classes">Back to Class List</link>
- </para>
- </sect3>
- <sect3 id="zend.service.yahoo.classes.imageresultset">
- <title>Zend_Service_Yahoo_ImageResultSet</title>
- <para>
- <code>Zend_Service_Yahoo_ImageResultSet</code> 代表一个 Yahoo! 图片搜索结果集
- </para>
- <note>
- <para>
- <code>Zend_Service_Yahoo_ImageResultSet</code> 扩展自 <link linkend="zend.service.yahoo.classes.resultset">Zend_Service_Yahoo_ResultSet</link>
- </para>
- </note>
- <para>
- <link linkend="zend.service.yahoo.classes">Back to Class List</link>
- </para>
- </sect3>
- <sect3 id="zend.service.yahoo.classes.localresultset">
- <title>Zend_Service_Yahoo_LocalResultSet</title>
- <para>
- <code>Zend_Service_Yahoo_LocalResultSet</code> 代表一个Yahoo!本地搜索的结果集
- </para>
- <table>
- <title>Zend_Service_Yahoo_LocalResultSet 属性</title>
- <tgroup cols="3">
- <thead>
- <row>
- <entry>名称</entry>
- <entry>类型</entry>
- <entry>描述</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>resultSetMapURL</entry>
- <entry>string</entry>
- <entry>包含返回查询结果地图的URL</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <note>
- <para>
- <code>Zend_Service_Yahoo_LocalResultSet</code> 扩展自 <link linkend="zend.service.yahoo.classes.resultset">Zend_Service_Yahoo_ResultSet</link>
- </para>
- </note>
- <para>
- <link linkend="zend.service.yahoo.classes">Back to Class List</link>
- </para>
- </sect3>
- <sect3 id="zend.service.yahoo.classes.newsresultset">
- <title>Zend_Service_Yahoo_NewsResultSet</title>
- <para>
- <code>Zend_Service_Yahoo_NewsResultSet</code> 代表一个Yahoo!新闻搜索结果的集合
- </para>
- <note>
- <para>
- <code>Zend_Service_Yahoo_NewsResultSet</code> 扩展自 <link linkend="zend.service.yahoo.classes.resultset">Zend_Service_Yahoo_ResultSet</link>
- </para>
- </note>
- <para>
- <link linkend="zend.service.yahoo.classes">Back to Class List</link>
- </para>
- </sect3>
- <sect3 id="zend.service.yahoo.classes.result">
- <title>Zend_Service_Yahoo_Result</title>
- <para>
- 每类搜索特定的结果都由这个基类扩展而成
- </para>
- <sect4 id="zend.service.yahoo.classes.result.properties">
- <title>Properties</title>
- <table>
- <title>Zend_Service_Yahoo_Result Properties</title>
- <tgroup cols="3">
- <thead>
- <row>
- <entry>名称</entry>
- <entry>类型</entry>
- <entry>描述</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>Title</entry>
- <entry>string</entry>
- <entry>结果项的标题</entry>
- </row>
- <row>
- <entry>Url</entry>
- <entry>string</entry>
- <entry>结果项的url</entry>
- </row>
- <row>
- <entry>ClickUrl</entry>
- <entry>string</entry>
- <entry>链接到结果项的url</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <para>
- <link linkend="zend.service.yahoo.classes">Back to Class List</link>
- </para>
- </sect4>
- </sect3>
- <sect3 id="zend.service.yahoo.classes.webresult">
- <title>Zend_Service_Yahoo_WebResult</title>
- <para>
- 每一个网页搜索结果作为一个 <code>Zend_Service_Yahoo_WebResult</code> 对相返回.
- </para>
- <sect4 id="zend.service.yahoo.classes.webresult.properties">
- <title>属性</title>
- <table>
- <title>Zend_Service_Yahoo_WebResult 属性</title>
- <tgroup cols="3">
- <thead>
- <row>
- <entry>名称</entry>
- <entry>类型</entry>
- <entry>描述</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>Summary</entry>
- <entry>string</entry>
- <entry>返回结果的摘要</entry>
- </row>
- <row>
- <entry>MimeType</entry>
- <entry>string</entry>
- <entry>返回结果的mimetype</entry>
- </row>
- <row>
- <entry>ModificationDate</entry>
- <entry>string</entry>
- <entry>一个以 UNIX timestamp 表示的最后修改日期.</entry>
- </row>
- <row>
- <entry>CacheUrl</entry>
- <entry>string</entry>
- <entry>返回结果Yahoo! 网页搜索缓存页面的URL</entry>
- </row>
- <row>
- <entry>CacheSize</entry>
- <entry>int</entry>
- <entry>Cache 项目的大小</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <para>
- <link linkend="zend.service.yahoo.classes">Back to Class List</link>
- </para>
- </sect4>
- </sect3>
- <sect3 id="zend.service.yahoo.classes.imageresult">
- <title>Zend_Service_Yahoo_ImageResult</title>
- <para>
- 每一个图片搜索结果作为一个 <code>Zend_Service_Yahoo_ImageResult</code> 对相返回.
- </para>
- <sect4 id="zend.service.yahoo.classes.imageresult.properties">
- <title>属性</title>
- <table>
- <title>Zend_Service_Yahoo_ImageResult 属性</title>
- <tgroup cols="3">
- <thead>
- <row>
- <entry>名称</entry>
- <entry>类型</entry>
- <entry>描述</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>Summary</entry>
- <entry>string</entry>
- <entry>返回结果的摘要</entry>
- </row>
- <row>
- <entry>RefererUrl</entry>
- <entry>string</entry>
- <entry>图片引用页的URL</entry>
- </row>
- <row>
- <entry>FileSize</entry>
- <entry>int</entry>
- <entry>以bytes为单位的图片大小</entry>
- </row>
- <row>
- <entry>FileFormat</entry>
- <entry>string</entry>
- <entry>图片的格式 (bmp, gif, jpeg, png, etc.)</entry>
- </row>
- <row>
- <entry>Height</entry>
- <entry>int</entry>
- <entry>图片的高</entry>
- </row>
- <row>
- <entry>Width</entry>
- <entry>int</entry>
- <entry>图片的宽</entry>
- </row>
- <row>
- <entry>Thumbnail</entry>
- <entry><link linkend="zend.service.yahoo.classes.image">Zend_Service_Yahoo_Image</link></entry>
- <entry>图片的缩略图</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <para>
- <link linkend="zend.service.yahoo.classes">Back to Class List</link>
- </para>
- </sect4>
- </sect3>
- <sect3 id="zend.service.yahoo.classes.localresult">
- <title>Zend_Service_Yahoo_LocalResult</title>
- <para>
- 每一个本地搜索结果以 <code>Zend_Service_Yahoo_LocalResult</code> 对相返回.
- </para>
- <sect4 id="zend.service.yahoo.classes.localresult.properties">
- <title>属性</title>
- <table>
- <title>Zend_Service_Yahoo_LocalResult 属性</title>
- <tgroup cols="3">
- <thead>
- <row>
- <entry>名称</entry>
- <entry>类型</entry>
- <entry>描述</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>Address</entry>
- <entry>string</entry>
- <entry>搜索结果的街道地址</entry>
- </row>
- <row>
- <entry>City</entry>
- <entry>string</entry>
- <entry>搜索结果所在的城市</entry>
- </row>
- <row>
- <entry>State</entry>
- <entry>string</entry>
- <entry>搜索结果所在的州</entry>
- </row>
- <row>
- <entry>Phone</entry>
- <entry>string</entry>
- <entry>搜索结果相关的电话号码</entry>
- </row>
- <row>
- <entry>Rating</entry>
- <entry>int</entry>
- <entry>用户对该结果的评分</entry>
- </row>
- <row>
- <entry>Distance</entry>
- <entry>float</entry>
- <entry>从你指定的位置到搜索结果的距离</entry>
- </row>
- <row>
- <entry>MapUrl</entry>
- <entry>string</entry>
- <entry>搜索结果地图的URL</entry>
- </row>
- <row>
- <entry>BusinessUrl</entry>
- <entry>string</entry>
- <entry>商务网站的URL (如果知道的话)</entry>
- </row>
- <row>
- <entry>BusinessClickUrl</entry>
- <entry>string</entry>
- <entry>链接到商务网站的URL (如果知道的话)</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <para>
- <link linkend="zend.service.yahoo.classes">Back to Class List</link>
- </para>
- </sect4>
- </sect3>
- <sect3 id="zend.service.yahoo.classes.newsresult">
- <title>Zend_Service_Yahoo_NewsResult</title>
- <para>
- 每一个新闻搜索结果作为一个 <code>Zend_Service_Yahoo_NewsResult</code> 对相返回.
- </para>
- <sect4 id="zend.service.yahoo.classes.newsresult.properties">
- <title>属性</title>
- <table>
- <title>Zend_Service_Yahoo_NewsResult 属性</title>
- <tgroup cols="3">
- <thead>
- <row>
- <entry>名称</entry>
- <entry>类型</entry>
- <entry>描述</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>Summary</entry>
- <entry>string</entry>
- <entry>返回结果的摘要</entry>
- </row>
- <row>
- <entry>NewsSource</entry>
- <entry>string</entry>
- <entry>发布文章的公司</entry>
- </row>
- <row>
- <entry>NewsSourceUrl</entry>
- <entry>string</entry>
- <entry>发布文章的公司的URL</entry>
- </row>
- <row>
- <entry>Language</entry>
- <entry>string</entry>
- <entry>文章所用的语言</entry>
- </row>
- <row>
- <entry>PublishDate</entry>
- <entry>string</entry>
- <entry>用 UNIX timestamp表示的文章发布日期</entry>
- </row>
- <row>
- <entry>ModificationDate</entry>
- <entry>string</entry>
- <entry>用 UNIX timestamp表示的文章最后更新日期</entry>
- </row>
- <row>
- <entry>Thumbnail</entry>
- <entry><link linkend="zend.service.yahoo.classes.image">Zend_Service_Yahoo_Image</link></entry>
- <entry>文章的缩略图,如果有的话</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <para>
- <link linkend="zend.service.yahoo.classes">Back to Class List</link>
- </para>
- </sect4>
- </sect3>
- <sect3 id="zend.service.yahoo.classes.image">
- <title>Zend_Service_Yahoo_Image</title>
- <para>
- 所有的Yahoo!图片和新闻搜索返回的图片都作为
- <code>Zend_Service_Yahoo_Image</code> 对相返回
- </para>
- <sect4 id="zend.service.yahoo.classes.image.properties">
- <title>Properties</title>
- <table>
- <title>Zend_Service_Yahoo_Image Properties</title>
- <tgroup cols="3">
- <thead>
- <row>
- <entry>名称</entry>
- <entry>类型</entry>
- <entry>描述</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>Url</entry>
- <entry>string</entry>
- <entry>图片URL</entry>
- </row>
- <row>
- <entry>Width</entry>
- <entry>int</entry>
- <entry>图片的宽</entry>
- </row>
- <row>
- <entry>Height</entry>
- <entry>int</entry>
- <entry>图片的高</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <para>
- <link linkend="zend.service.yahoo.classes">Back to Class List</link>
- </para>
- </sect4>
- </sect3>
- </sect2>
- </sect1>
- <!--
- vim:se ts=4 sw=4 et:
- -->
|