我想知道如何获得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。 –