UPDATE: I don't believe this is an exact duplicate because my question is dealing specifically with SimpleXmlElement and gives a clear example with my XML and even a reference to the class. The question you believe my duplicate is refers to: simplexml_load_file and not SimpleXmlElement. Also it does not give a clear example with code like mine does. The answer given in the alleged is not very clear for my purposes. Finally the duplicate question answer gives dead links in the code so we can't see the example code.
I did figure out the answer:
$length = $entry->children('itunes', TRUE)->duration;
Please consider opening up this question again so I can offer this clear example to others. - Thanks –
Using php SimpleXmlElement how can I get a xml tag with colon in it? Example: <itunes:duration>33:00</itunes:duration>
Here is info on the SimpleXmlElement Class
Here is a sample item from the XML I am accessing:
<item>
<title>7th Video Exposing Planned Parenthood Is Released - The Terry and Jesse Show - August 19, 2015</title>
<pubDate>Wed, 19 Aug 2015 12:00:00 +0000</pubDate>
<guid isPermaLink="false"><![CDATA[140b435c9de567175da347928406caeb]]></guid>
<link><![CDATA[http://saintjoepodcast.libsyn.com/7th-video-exposing-planned-parenthood-is-released-the-terry-and-jesse-show-august-19-2015]]></link>
<itunes:image href="http://static.libsyn.com/p/assets/0/7/5/9/0759313aabd1b45e/jesse-n-terry_banner-new.png" />
<description><![CDATA[]]></description>
<enclosure length="26345472" type="audio/mpeg" url="http://traffic.libsyn.com/saintjoepodcast/The_Terry_and_Jesse_Show_-_August_19_2015_-_7th_Video_Exposing_Planned_Parenthood_Is_Released.mp3" />
<itunes:duration>58:02</itunes:duration>
<itunes:explicit>no</itunes:explicit>
<itunes:keywords />
<itunes:subtitle><![CDATA[]]></itunes:subtitle>
</item>
Below is the php where I can abstract a simple xml tag, like 'Title', but how do I get the info of an tag that has a colon in it? Example: <itunes:duration>33:00</itunes:duration>
FULL PHP:
<?
$content = file_get_contents("http://saintjoepodcast.libsyn.com/rss");
$x = new SimpleXmlElement($content);
echo "<nav><ul>";
foreach($x->channel->item as $entry)
{
echo "<li><a href='$entry->link' title='$entry->title'>" . $entry->title . "</a></li>";
}
echo "</ul></nav>";
?>