# Looking for help parsing xml with php, me = fail

**URL:** <https://forums.speedlife.net/t/looking-for-help-parsing-xml-with-php-me-fail/37817>\
**Category:** NYSpeed Off Topic\
**Created:** [October 29, 2007, 12:23pm UTC](https://forums.speedlife.net/t/looking-for-help-parsing-xml-with-php-me-fail/37817 "2007-10-29T12:23:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![neonglh](https://yyz2.discourse-cdn.com/flex034/user_avatar/forums.speedlife.net/neonglh/32/4951_2.png) [@neonglh](https://forums.speedlife.net/u/neonglh)\
**Post date:** [October 29, 2007, 12:23pm UTC](https://forums.speedlife.net/t/looking-for-help-parsing-xml-with-php-me-fail/37817/1 "2007-10-29T12:23:06Z")

</div>

I am making a section of our University News utilize our RSS feed better, to allow more information to be displayed. Our RSS file can be viewed here:

> **[thetigerbeat.com](http://thetigerbeat.com/rss/podcast.rss)**
>
> This domain may be for sale!

Here is a snipit of xml code that will help explain my problem:

> \<item\>  
> \<title\>RIT NEWSMINUTE (Oct. 29, 2007) \</title\>  
> \<itunes:author\>RIT University News Services\</itunes:author\>  
> \<itunes:subtitle\>RIT NEWSMINUTE (Oct. 29, 2007) (Episode 9)\</itunes:subtitle\>  
> \<itunes:summary\>RIT events for the week of Oct. 29-Nov. 4, 2007\</itunes:summary\>  
> \<enclosure url=“[thetigerbeat.com](http://www.thetigerbeat.com/rss/podcasts/rit_newsminute_10-29-07.m4a)” length=“574166” type=“audio/x-m4a” /\>  
> \<guid\>[thetigerbeat.com](http://www.thetigerbeat.com/rss/podcasts/rit_newsminute_10-29-07.rtf&lt;/guid&gt);  
> \<pubDate\>Mon, 29 Oct 2007 03:01:00 EDT\</pubDate\>  
> \<itunes:duration\>01:01\</itunes:duration\>  
> \<itunes:keywords\>campus, education, events, institute, minute, ntid, news, rit, rochester, saffran, technology\</itunes:keywords\>  
> I currently use a PHP script to pull the data I am looking for.

> \<?php  
> $numPodcasts = 5;  
> $rss = file\_get\_contents(“[thetigerbeat.com](http://thetigerbeat.com/rss/podcast.rss)”);  
> $feed = simplexml\_load\_string(utf8\_encode($rss));  
> $children = $feed-\>children();
> 
> ```
> for($x=0; $x&lt;$numPodcasts; $x++) :
> $item = $children-&gt;channel-&gt;item[$x];
> 
> ```

> ```
> echo '&lt;a href="' . $item-&gt;enclosure["url"] . '"&gt;' . $item-&gt;title . '&lt;/a&gt;';
>                    
> endfor;
> ?&gt;
> 
> ```

Its easy. To pull the title, I use the syntax:

$item-\>title

To pull the enclosure tag, which holds the URL information, I use this syntax:

$item-\>enclosure[“url”]

This all works fine and dandy, until we get to the itunes tags that are built in to the rss feed we are producing. The tags are not simple xml tags like **title** and **enclosure** , they are like this:

\<itunes:duration\>01:01\</itunes:duration\>

So… my question is, how can I pull this information into my code. I have tried looking this up, and I can’t find any examples of how people get it to work. If you try the obvious of just:

$item-\>itunes:duration

The code breaks. I have tried almost every variation of that as well. Any ideas from you geeks out there?
