2012-02-01 2 views
0

code.google.comのAPIを取得する私は、この機能を使用している:私は与えられた動画IDを渡すと、それは私を与える関数のprintVideoEntry($のVideoEntryを)とPHP</p> <p>ごとに異なる動画IDのYouTube

Video ID: XXXXXXXXXXXXXXXXXXXXXXXXXX
Watch page: http://www.youtube.com/watch?v=YYYYYYYYYYYYYY&feature=youtube_gdata_player
Flash Player Url: http://www.youtube.com/v/YYYYYYYYYYYYY?version=3&f=playlists&app=youtube_gdata

を得ましたエラー:

Uncaught exception 'Zend_Gdata_App_HttpException' with message 'Expected response code 200, got 400 Invalid id'

そして、私はウォッチページとFlash PlayerのURLからYYYYYYYYYYYYYYYYY渡す場合、私は必要なもの、私はそれを取得しています[両方が同じです]。

ご協力いただきありがとうございます。 :あなたはIDに基づいて取得することができVideoEntry -object、あるべき私は

function getAndPrintPlaylistVideoFeed($playlistListEntry) { 
    $yt = new Zend_Gdata_YouTube(); 
    $playlistVideoFeed = $yt->getPlaylistVideoFeed($playlistListEntry->getPlaylistVideoFeedUrl()); 
    foreach ($playlistVideoFeed as $playlistVideoEntry) { 
    $getandprintplaylistvideofeed_array[] = printVideoEntry($playlistVideoEntry); 
    } 
+0

謝罪をdocsをチェックこれは最初の質問フォーム私stackoverflow .. –

答えて

0

$videoEntryから印刷ビデオ機能を呼んでいるビデオエントリに

function printVideoEntry($videoEntry) { 
    echo "<div onclick=\"ytvbp.presentVideo('".$videoEntry->getVideoId()."')\" >"; 
    echo 'Video: '.$videoEntry->getVideoTitle() . "<br>"; 
    echo "</div>"; 
    echo 'Video ID: ' . $videoEntry->getVideoId() . "<br>"; 
    echo 'Watch page: ' . $videoEntry->getVideoWatchPageUrl() . "<br>"; 
    echo 'Flash Player Url: ' . $videoEntry->getFlashPlayerUrl() . "<br>"; 
} 

を取得するため、この機能を使用する

$videoEntry = $yt->getVideoEntry('the0KZLEacs'); 

次に、関数を呼び出してパラメータとして帽子:

printVideoEntry($videoEntry); 

それとも、printVideoEntryの最初の行を編集できます。

function printVideoEntry($videoId) { 
    $videoEntry = $yt->getVideoEntry('the0KZLEacs'); 
    //... 
} 

)=あなたはVideoEntryを絞り出すことができますどのような情報を見るために

関連する問題