当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Rest_Client::method方法代码示例

本文整理汇总了PHP中Zend_Rest_Client::method方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Rest_Client::method方法的具体用法?PHP Zend_Rest_Client::method怎么用?PHP Zend_Rest_Client::method使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Rest_Client的用法示例。


在下文中一共展示了Zend_Rest_Client::method方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testFlickrEcho

 function testFlickrEcho()
 {
     if (!TESTS_ZEND_REST_CLIENT_FLICKR_APIKEY) {
         $this->markTestSkipped("Flickr API Key not found");
     }
     $client = new Zend_Rest_Client('http://api.flickr.com/services/rest/');
     $result = $client->method('flickr.test.echo')->name('Davey Shafik')->api_key(TESTS_ZEND_REST_CLIENT_FLICKR_APIKEY)->get()->name;
     $this->assertEquals("Davey Shafik", $result);
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:9,代码来源:ClientTest.php

示例2:

<?php

/**
 * @file
 * @ingroup DAPCPTest
 * 
 * @author Dian
 */
require_once 'Zend/Rest/Client.php';
$client = new Zend_Rest_Client('http://localhost/mw/api.php?action=wspcp&format=xml');
#$client->readPage("WikiSysop", NULL, NULL, NULL, NULL, "Main Page")->get();
$client->method("readPage");
$client->title("Main Page");
$result = $client->get();
var_dump($result->wspcp()->text);
//echo $client->createPage("WikiSysop", NULL, NULL, NULL, NULL, "REST Test", "Adding some content")->get()->getIterator()->asXML();
//$__obj = $client->readPage("WikiSysop", NULL, NULL, NULL, NULL, "Main Page")->get();
//$__res = $__obj->__toString();
//var_dump($client->readPage("WikiSysop", NULL, NULL, NULL, NULL, "Main Page")->get());
//echo $client->login("WikiSysop", "!>ontoprise?")->get();
//var_dump($client->sayHello("Tester", "now")->get());
开发者ID:seedbank,项目名称:old-repo,代码行数:21,代码来源:TestZendRESTClient.php

示例3: photoAction

 public function photoAction()
 {
     $this->_helper->viewRenderer->setNoRender();
     //suppress auto-rendering
     $boolShowPhotos = false;
     $searchTag = $this->_request->getParam('searchTag');
     $html = '';
     if (empty($searchTag)) {
         $html .= "Please enter search keyword";
     } else {
         try {
             $currentPage = 1;
             $i = $this->_request->getParam('page');
             $currentPage = !empty($i) ? $i : 1;
             //initialize client with data set
             $client = new Zend_Rest_Client('http://api.flickr.com/services/rest/');
             // set method name and API key
             $client->method('flickr.photos.search');
             $client->api_key($this->flickrAPIKey);
             // set method arguments
             $client->tags($searchTag);
             // perform request and process response
             $result = $client->get();
             $photos = array();
             if (isset($result)) {
                 foreach ($result->photos->photo as $photo) {
                     $photos[] = array('thumbnail' => sprintf('http://farm%s.static.flickr.com/%s/%s_%s_t.jpg', $photo['farm'], $photo['server'], $photo['id'], $photo['secret']), 'original' => sprintf('http://farm%s.static.flickr.com/%s/%s_%s_b.jpg', $photo['farm'], $photo['server'], $photo['id'], $photo['secret']), 'title' => $photo['title'], 'ownername' => $photo['owner']);
                 }
             }
             $html .= "<table align='center' width='90%' cellpadding='2' cellspacing='2'>";
             if (!empty($photos)) {
                 $paginator = Zend_Paginator::factory($photos);
                 $paginator->setItemCountPerPage(5);
                 $paginator->setPageRange(3);
                 $paginator->setCurrentPageNumber($currentPage);
                 Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml');
                 $this->view->paginator = $paginator;
                 Zend_Paginator::setDefaultScrollingStyle('Sliding');
                 if ($paginator) {
                     $html .= "<tr><td colspan='5' align='center'>" . $paginator . "</td></tr>";
                     $html .= "<tr><td colspan='5' height='20'></td></tr>";
                     $html .= "<tr>";
                     $cnt = 1;
                     foreach ($paginator as $photo) {
                         $thumbnail = $photo['thumbnail'];
                         $title = $photo['title'];
                         $img = !empty($photo['original']) ? $photo['original'] : '';
                         $ownername = $photo['ownername'];
                         $html .= "<td width='20%' align='center'>";
                         if (!empty($img)) {
                             $html .= "<a href='" . $img . "' target='_blank'><img title='" . $title . "' class='thumb' src='" . $thumbnail . "'></a>";
                             $html .= "<br><a title='" . $ownername . "' href='" . $img . "' target='_blank'>{$ownername}</a>";
                         } else {
                             $html .= "<img class='thumb' src='" . $thumbnail . "' title='" . $title . "'>";
                             $html .= "</br>" . $ownername;
                         }
                         $html .= "<br></td>";
                         $cnt++;
                     }
                     $html .= "</tr>";
                     $html .= "<tr><td colspan='5' height='20'></td></tr>";
                     $html .= "<tr><td colspan='5' align='center'>" . $paginator . "</td></tr>";
                     $html .= "</tr>";
                 }
             } else {
                 $html .= "<tr><td colspan='5'><br><br><font color='red'>Sorry, No photos available.</td></tr>";
             }
             $html .= "</table>";
         } catch (Exception $e) {
             $html .= 'ERROR: ' . $e->getMessage();
         }
         echo $html;
     }
 }
开发者ID:hirenpatel,项目名称:Flicker,代码行数:74,代码来源:IndexController.php


注:本文中的Zend_Rest_Client::method方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。