Jump to content
Sign in to follow this  
bigt95nt0110

colon in the enclosure tag for RSS

Recommended Posts

below is an enclosure tag from craigslist RSS feed. Can anyone tell me what the "enc:" in the tag means

<enc:enclosure resource="http://images.craigslist.org/00Y0Y_kZI4M6ZKl0o_300x300.jpg" type="image/jpeg"/>

Share this post


Link to post
Share on other sites

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.

Share this post


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();    }}

Share this post


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?

Share this post


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"

Share this post


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...
Sign in to follow this  

×
×
  • Create New...