Jump to content

colon in the enclosure tag for RSS


Recommended Posts

That's called a namespace. It means the tag isn't from RSS, but from their own custom schema. You can probably find more information about the schema by finding the URL shown in the xmlns:enc attribute in the root element.

Link to post
Share on other sites

Below is a snipit of code that I got from SimplePie that is suppose to parse an enclosure for it's contents, but when I run it I get a blank page. I know that the feed has enclosure tags present. What am I missing?

$feed = new SimplePie();$feed->set_feed_url('http://simplepie.org/blog/feed/');$feed->init();$feed->handle_content_type();foreach ($feed->get_items() as $item){    foreach ($item->get_enclosures() as $enclosure)    {        echo $enclosure->embed();    }}
Link to post
Share on other sites

A blank page usually comes from a fatal error that's being supressed. You can add the following code to the beginning of your page during debugging in order to see errors:

<?phpini_set('display_errors', 1);error_reporting(E_ALL);

I have a guess as to what the error might be, though.

 

Have you forgotten to include the file that defines the SimplePie() class?

Link to post
Share on other sites

Below is the full code I'm running.

<?phpinclude_once('../autoloader.php');ini_set('display_errors', 1);error_reporting(E_ALL);$feed = new SimplePie();$feed->set_feed_url('http://simplepie.org/blog/feed/');$feed->init();$feed->handle_content_type();foreach ($feed->get_items() as $item){    foreach ($item->get_enclosures() as $enclosure)    {        echo $enclosure->embed();        echo "here<br>"    }}?>

The loop executes for each $enclosure but no output but "here"

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...