當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。