Hi david just wondering what PHP code would i use to see if an RSS feed has an enclosure like the one below. All I need out of that is the URL link http://www.v8supercars.com.au/content/panelbeaters_podcast/2008_round_14... 14 Podcast.mp3
Any help welcomed.
<enclosure url="http://www.v8supercars.com.au/content/panelbeaters_podcast/2008_round_14_oran_park/files/20622/Round 14 Podcast.mp3" type="audio/x-mpeg"></enclosure>Thanks


Hi Russell, If you parse the
Hi Russell,
If you parse the feed with Magic Parser, you just need to look for $record["ENCLOSURE-URL"] in your myRecordHandler function. However, as the feed contains multiple podcast URLs (one in each item), if it's just the first one you're after remember to return TRUE to stop the parse. For example;
<?php
require("MagicParser.php");
function myRecordHandler($record)
{
if ($record["ENCLOSURE-URL"])
{
print "Enclosure found: ".$record["ENCLOSURE-URL"];
}
return TRUE;
}
MagicParser_parse("http://www.v8supercars.com.au/content/panelbeaters_podcast/podcast.xml","myRecordHandler","xml|RSS/CHANNEL/ITEM/");
?>
Hi David, I am not using
Hi David, I am not using Magic Parser at this time. I am using simplexml_load_file
If you can help with that that would be great.
I am guessing it would be the following
if ($item->enclosure){
print $item->enclosure["url"];
}
would that be correct?
Hi Russell, It's generally
Hi Russell,
It's generally best to test the actual variable you will be using; e.g.
if ($item->enclosure["url"]){
print $item->enclosure["url"];
}
Remember that url is an attribute of the enclosure tag, so check exactly how that is being represented in your array. If you're not sure; use print_r() to take a look:
print_r($item);Cheers,
David.