bigt95nt0110 Posted June 2, 2014 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"/> Link to comment Share on other sites More sharing options...
Ingolme Posted June 2, 2014 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. Link to comment Share on other sites More sharing options...
bigt95nt0110 Posted June 2, 2014 Author 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(); }} Link to comment Share on other sites More sharing options...
Ingolme Posted June 2, 2014 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? Link to comment Share on other sites More sharing options...
bigt95nt0110 Posted June 3, 2014 Author 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" Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now