bigt95nt0110 0 Posted June 2, 2014 Report Share Posted June 2, 2014 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"/> Quote Link to post Share on other sites
Ingolme 1,027 Posted June 2, 2014 Report Share Posted June 2, 2014 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. Quote Link to post Share on other sites
bigt95nt0110 0 Posted June 2, 2014 Author Report Share Posted June 2, 2014 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(); }} Quote Link to post Share on other sites
Ingolme 1,027 Posted June 2, 2014 Report Share Posted June 2, 2014 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? Quote Link to post Share on other sites
bigt95nt0110 0 Posted June 3, 2014 Author Report Share Posted June 3, 2014 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" Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.