2011-09-27 119 views
0

我使用了Zend的GData和YouTube API上傳vidoes到YouTube http://code.google.com/apis/youtube/2.0/developers_guide_php.html#Direct_Upload獲取加載影片響應到YouTube

當我上傳視頻我該如何捕捉生成的視頻ID,並在YouTube鏈接?

try 
{ 
    $newEntry = $yt->insertEntry($myVideoEntry,$uploadUrl,'Zend_Gdata_YouTube_VideoEntry'); 
} 
catch (Zend_Gdata_App_HttpException $httpException) 
{ 
    echo $httpException->getRawResponseBody(); 
} 
catch (Zend_Gdata_App_Exception $e) 
{ 
    echo $e->getMessage(); 
} 

非常感謝你

回答

2

這條線:

$newEntry = $yt->insertEntry($myVideoEntry,$uploadUrl,'Zend_Gdata_YouTube_VideoEntry'); 

返回Zend_Gdata_YouTube_VideoEntry對象。

The Zend Framework API docs for Zend_Gdata_YouTube_VideoEntry列出了類可用的所有方法和屬性。並且它是自動生成的,所以如果手冊沒有回答問題,那麼這往往是一個很好的選擇。

從那裏看,我會說,你會打電話:

  • $newEntry->getVideoId()獲得視頻ID
  • $newEntry->getVideoWatchPageUrl()獲得視頻網址
+0

非常感謝您! 它的工作原理! – Yan