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


PHP Zend_Gdata_YouTube::getHttpClient方法代码示例

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


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

示例1: __construct

 public function __construct()
 {
     $this->yt = new Zend_Gdata_YouTube(null, 'vlc-shares/' . X_VlcShares::VERSION . ' youtube/' . self::VERSION, null, 'AI39si4HbHoRBg1vlyLlRARR1Bl2TWqUy4LuCFHpS6ZnZ2LxlqbCLrgh8kDBj-7h2lkDs99cvaOZRm-4p-GlEP2rxtD6BZ9dcg');
     $this->yt->setMajorProtocolVersion(2);
     $this->yt->getHttpClient()->setHeaders('User-Agent', 'vlc-shares/' . X_VlcShares::VERSION . ' youtube/' . self::VERSION);
     $this->yt->setGzipEnabled(true);
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:7,代码来源:Youtube.php

示例2: set_transport_authentication_params

 /**
  *
  * @return Bridge_Api_Youtube
  */
 protected function set_transport_authentication_params()
 {
     if ($this->_auth->is_connected()) {
         $signatures = $this->_auth->get_auth_signatures();
         $this->_api->getHttpClient()->setAuthSubToken($signatures['auth_token']);
     }
     return $this;
 }
开发者ID:nlegoff,项目名称:Phraseanet,代码行数:12,代码来源:Youtube.php

示例3: testSetClientIDAndDeveloperKeyHeader

 public function testSetClientIDAndDeveloperKeyHeader()
 {
     $applicationId = 'MyTestCompany-MyTestApp-0.1';
     $clientId = 'MyClientId';
     $developerKey = 'MyDeveloperKey';
     $httpClient = new Zend_Http_Client();
     $yt = new Zend_Gdata_YouTube($httpClient, $applicationId, $clientId, $developerKey);
     $this->assertTrue($yt instanceof Zend_Gdata_YouTube);
     $client = $yt->getHttpClient();
     $this->assertEquals($client->getHeader('X-Gdata-Key'), 'key=' . $developerKey);
     $this->assertEquals($client->getHeader('X-Gdata-Client'), $clientId);
 }
开发者ID:robertfoleyjr,项目名称:robertfoleyjr-d6,代码行数:12,代码来源:YouTubeTest.php

示例4: searchVideos

/**
 * Perform a search on youtube. Passes the result feed to echoVideoList.
 *
 * @param string $searchType The type of search to perform.
 * If set to 'owner' then attempt to authenticate.
 * @param string $searchTerm The term to search on.
 * @param string $startIndex Start retrieving search results from this index.
 * @param string $maxResults The number of results to retrieve.
 * @return void
 */
function searchVideos($searchType, $searchTerm, $startIndex, $maxResults)
{
    // create an unauthenticated service object
    $youTubeService = new Zend_Gdata_YouTube();
    $query = $youTubeService->newVideoQuery();
    $query->setQuery($searchTerm);
    $query->setStartIndex($startIndex);
    $query->setMaxResults($maxResults);
    switch ($searchType) {
        case 'most_viewed':
            $query->setFeedType('most viewed');
            $query->setTime('this_week');
            $feed = $youTubeService->getVideoFeed($query);
            break;
        case 'most_recent':
            $query->setFeedType('most recent');
            $query->setTime('this_week');
            $feed = $youTubeService->getVideoFeed($query);
            break;
        case 'recently_featured':
            $query->setFeedType('recently featured');
            $feed = $youTubeService->getVideoFeed($query);
            break;
        case 'top_rated':
            $query->setFeedType('top rated');
            $query->setTime('this_week');
            $feed = $youTubeService->getVideoFeed($query);
            break;
        case 'username':
            $feed = $youTubeService->getUserUploads($searchTerm);
            break;
        case 'all':
            $feed = $youTubeService->getVideoFeed($query);
            break;
        case 'owner':
            $httpClient = getAuthSubHttpClient();
            $youTubeService = new Zend_Gdata_YouTube($httpClient);
            try {
                $feed = $youTubeService->getUserUploads('default');
                if (loggingEnabled()) {
                    logMessage($httpClient->getLastRequest(), 'request');
                    logMessage($httpClient->getLastResponse()->getBody(), 'response');
                }
            } catch (Zend_Gdata_App_HttpException $httpException) {
                print 'ERROR ' . $httpException->getMessage() . ' HTTP details<br /><textarea cols="100" rows="20">' . $httpException->getRawResponseBody() . '</textarea><br />' . '<a href="session_details.php">' . 'click here to view details of last request</a><br />';
                return;
            } catch (Zend_Gdata_App_Exception $e) {
                print 'ERROR - Could not retrieve users video feed: ' . $e->getMessage() . '<br />';
                return;
            }
            echoVideoList($feed, true);
            return;
        default:
            echo 'ERROR - Unknown search type - \'' . $searchType . '\'';
            return;
    }
    if (loggingEnabled()) {
        $httpClient = $youTubeService->getHttpClient();
        logMessage($httpClient->getLastRequest(), 'request');
        logMessage($httpClient->getLastResponse()->getBody(), 'response');
    }
    echoVideoList($feed);
}
开发者ID:holdensmagicalunicorn,项目名称:copperFramework,代码行数:73,代码来源:operations.php

示例5: getYoutubeVideoSuggestions

 public function getYoutubeVideoSuggestions()
 {
     if (Mage::helper('videogallery')->isVideoSuggestionsEnabled() == false) {
         return array();
     }
     if (!$this->_youtubeFeed) {
         try {
             $product = $this->getProduct();
             if (!$product->getId()) {
                 return array();
             }
             $yt = new Zend_Gdata_YouTube();
             $yt->getHttpClient()->setConfig(array('timeout' => 10));
             $query = $yt->newVideoQuery();
             $query->videoQuery = $product->getName() . ' ' . $product->getSku();
             $query->startIndex = 0;
             $query->maxResults = 5;
             $results = $yt->getVideoFeed($query);
             $this->_youtubeFeed = array();
             foreach ($results as $video) {
                 if ($this->videoAlreadyAdded($video->getVideoId())) {
                     continue;
                 }
                 $this->_youtubeFeed[] = $video;
             }
         } catch (Exception $e) {
             return "Error Retrieving Video Suggestions from Youtube: " . $e->getMessage();
         }
     }
     return $this->_youtubeFeed;
 }
开发者ID:xiaoguizhidao,项目名称:bb,代码行数:31,代码来源:Content.php


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