Quantcast
Channel: Active questions tagged atom-feed+parsing - Stack Overflow
Viewing all articles
Browse latest Browse all 30

Unable to parse atom feed

$
0
0

I am implementing Youtube push notification and implemented webhook. Youtube gives updates in the form of atom feed. My problem is i can't parse that feed.

This is the XML:

<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:yt="http://www.youtube.com/xml/schemas/2015">
<link rel="hub" href="https://pubsubhubbub.appspot.com" />
<link rel="self" href="https://www.youtube.com/xml/feeds/videos.xml?channel_id=UCaNoTnXcQQt3ody_cLZSihw" />
<title>YouTube video feed</title>
<updated>2018-03-01T07:21:59.144766801+00:00</updated>
<entry>
    <id>yt:video:vNQyYJqFopE</id>
    <yt:videoId>vNQyYJqFopE</yt:videoId>
    <yt:channelId>UCaNoTnXcQQt3ody_cLZSihw</yt:channelId>
    <title>Test Video 4</title>
    <link rel="alternate" href="https://www.youtube.com/watch?v=vNQyYJqFopE" />
    <author>
        <name>Testing</name>
        <uri>https://www.youtube.com/channel/UCaNoTnXcQQt3ody_cLZSihw</uri>
    </author>
    <published>2018-03-01T07:21:48+00:00</published>
    <updated>2018-03-01T07:21:59.144766801+00:00</updated>
</entry>

 <?php
   $xml = '<?xml versio......';
   $obj = simplexml_load_string($xml);
   echo '<pre>';print_r($obj);echo '</pre>';

Screenshot

How to get the value of yt:videoId element. I am new to PHP, if I did anything wrong please correct me.


Viewing all articles
Browse latest Browse all 30

Latest Images

Trending Articles





Latest Images