Jump to content

colon in the enclosure tag for RSS


bigt95nt0110
 Share

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 comment
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 comment
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 comment
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 comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...