I want to read some data of the latest video on a youtube channel.
So i load the feed with simplexml_load_file and after that I use XPath for navigate to nodes.
$xmlFeed = simplexml_load_file("https://www.youtube.com/feeds/videos.xml?channel_id=UCo0bvu1jzU4WpHS3FglLU8g");
echo $xmlFeed->xpath("//entry[1]/title")[0];
echo $xmlFeed->xpath("//entry[1]/link")[0];
echo $xmlFeed->xpath("//entry[1]/id")[0];
I tried multiple style of XPath and it never work, I also tried to use DOMDocument and DOMXPath classes and it didn't work.
I use similar code for a wordpress rss and all works fine.
What am I wrong?