我想知道如何獲得YouTube視頻ID,我的API打印出來的內容。我想獲取頁面內容,而不是源代碼。如果有人想看看它的樣子,這裏是API網址:http://fnapi.cpt-design.tk/api.php從URL獲取頁面內容
我有這個迄今爲止
<?php $id = NULL;
$channel_id = 'UCd_09Tp1Bk05gDqc1RWyhuw';
$xml = simplexml_load_file(sprintf('youtube.com/feeds/videos.xml?channel_id=%s';, $channel_id));
if (!empty($xml->entry[0]->children('yt', true)->videoId[0])){
$id = $xml->entry[0]->children('yt', true)->videoId[0];
}
echo $id;
?>
歡迎堆棧溢出!我們需要更多的細節(以及更深入的解釋,以及目前的代碼)。 –
@DavidGomes http://pastebin.com/iHvx3vJR 這是我唯一的代碼。我想用JQuery打印出這個ID。 –