Ok so I have this xml file

<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
	<channel>
		<atom:link rel="self" href="http://www.ubcmiami.org/podcasts/podcast.xml" type="application/rss+xml" />
		<lastBuildDate>Mon, 09 Mar 2009 17:17:39 -0400</lastBuildDate>
		<title>UBC Miami - Messages</title>
		<itunes:author>UBC Miami</itunes:author>
		<link>http://www.ubcmiami.org</link>

		<generator>Podcast Maker v1.3.8b - http://www.lemonzdream.com/podcastmaker</generator>
		<description><![CDATA[Weekend Messages from UBC in Miami, FL.  We are transformational community living out the Gospel of Jesus Christ together: Changing Lives, Changing Families, Changing the World.  To find out more about us visit http://www.ubcmiami.org

We offer these podcasts free of charge, but if you would like to make a donation towards our ministry in Miami and around the globe visit: http://www.ubcmiami.org/donation]]></description>
		<itunes:subtitle />
		<itunes:summary>Weekend Messages from UBC in Miami, FL.  We are transformational community living out the Gospel of Jesus Christ together: Changing Lives, Changing Families, Changing the World.  To find out more about us visit http://www.ubcmiami.org

We offer these podcasts free of charge, but if you would like to make a donation towards our ministry in Miami and around the globe visit: http://www.ubcmiami.org/donation</itunes:summary>
		<language>en</language>
		<copyright>2007 UBCMIAMI</copyright>
		<image>

			<url>http://www.ubcmiami.org/podcasts/ubcpodcast_144.jpg</url>
			<title>UBC Miami - Messages</title>
			<link>http://www.ubcmiami.org</link>
			<width>144</width>
			<height>126</height>
		</image>

		<itunes:image href="http://www.ubcmiami.org/podcasts/ubcpodcast.jpg" />
		<category>Christianity</category>
		<itunes:category text="Religion &amp; Spirituality">
			<itunes:category text="Christianity" />
		</itunes:category>
		<itunes:keywords>ubc ubcmiami bill white university baptist church miami christian</itunes:keywords>
		<itunes:explicit>clean</itunes:explicit>

		<item>
			<title>Storming the Gates of Hell: Your Adversary, the Devil</title>
			<itunes:author>UBC Miami</itunes:author>
			<description><![CDATA[Storming the Gates of Hell: 1/5 Message Series by Bill White. For more information, visit ubcmiami.org. Copyright 2009 UBCMIAMI #20090060]]></description>
			<itunes:subtitle>Storming the Gates of Hell: 1/5 Message Series by Bill White. For more information, visit ubcmiami.org. Copyright 2009 UBCMIAMI #20090060</itunes:subtitle>
			<itunes:summary />
			<enclosure type="audio/mpeg" url="http://www.ubcmiami.org/podcasts/Storming%20the%20Gates%20of%20Hell_%20Your%20Adversary%2C%20the%20Devil.mp3" length="24187506" />

			<guid>http://www.ubcmiami.org/podcasts/Storming%20the%20Gates%20of%20Hell_%20Your%20Adversary%2C%20the%20Devil.mp3</guid>
			<pubDate>Sun, 08 Mar 2009 17:16:38 -0400</pubDate>
			<category>Religion &amp; Spirituality</category>
			<itunes:explicit>clean</itunes:explicit>
			<itunes:duration>00:41:40</itunes:duration>

			<itunes:keywords>ubc ubcmiami bill white university baptist church miami christian</itunes:keywords>
		</item>
		<item>
			<title>Q1: The Bottom Line</title>
			<itunes:author>Bill White</itunes:author>
			<description><![CDATA[Q1: 9/9 Message Series by Bill White. For more information, visit ubcmiami.org. Copyright 2009 UBCMIAMI #20090059]]></description>
			<itunes:subtitle>Q1: 9/9 Message Series by Bill White. For more information, visit ubcmiami.org. Copyright 2009 UBCMIAMI #20090059</itunes:subtitle>

			<itunes:summary />
			<enclosure type="audio/mpeg" url="http://www.ubcmiami.org/podcasts/Q1_%20The%20Bottom%20Line.mp3" length="19068161" />
			<guid>http://www.ubcmiami.org/podcasts/Q1_%20The%20Bottom%20Line.mp3</guid>
			<pubDate>Sun, 01 Mar 2009 11:34:45 -0500</pubDate>
			<category>Religion &amp; Spirituality</category>
			<itunes:explicit>clean</itunes:explicit>

			<itunes:duration>00:31:36</itunes:duration>
			<itunes:keywords>ubc ubcmiami bill white university baptist church miami christian</itunes:keywords>
		</item>
		<item>
			<title>Q1: You&apos;re Not Getting Any Younger</title>
			<itunes:author>Bill White</itunes:author>

			<description><![CDATA[Q1: 8/9 Message Series by Bill White. For more information, visit ubcmiami.org. Copyright 2009 UBCMIAMI #20090058]]></description>
			<itunes:subtitle>Q1: 8/9 Message Series by Bill White. For more information, visit ubcmiami.org. Copyright 2009 UBCMIAMI #20090058</itunes:subtitle>
			<itunes:summary />
			<enclosure type="audio/mpeg" url="http://www.ubcmiami.org/podcasts/Q1_%20You%27re%20Not%20Getting%20Any%20Younger.mp3" length="19603247" />
			<guid>http://www.ubcmiami.org/podcasts/Q1_%20You%27re%20Not%20Getting%20Any%20Younger.mp3</guid>
			<pubDate>Sun, 22 Feb 2009 17:41:43 -0500</pubDate>
			<category>Religion &amp; Spirituality</category>

			<itunes:explicit>clean</itunes:explicit>
			<itunes:duration>00:34:10</itunes:duration>
			<itunes:keywords>ubc ubcmiami bill white university baptist church miami christian</itunes:keywords>
		</item>
		<item>
			<title>Q1: Good News Bad News</title>
			<itunes:author>Bill White</itunes:author>

			<description><![CDATA[Q1: 7/9 Message Series by Bill White. For more information, visit ubcmiami.org. Copyright 2009 UBCMIAMI #20090057]]></description>
			<itunes:subtitle>Q1: 7/9 Message Series by Bill White. For more information, visit ubcmiami.org. Copyright 2009 UBCMIAMI #20090057</itunes:subtitle>
			<itunes:summary />
			<enclosure type="audio/mpeg" url="http://www.ubcmiami.org/podcasts/Q1_%20Good%20News%20Bad%20News.mp3" length="20221783" />
			<guid>http://www.ubcmiami.org/podcasts/Q1_%20Good%20News%20Bad%20News.mp3</guid>
			<pubDate>Sun, 15 Feb 2009 17:40:54 -0500</pubDate>
			<category>Religion &amp; Spirituality</category>

			<itunes:explicit>clean</itunes:explicit>
			<itunes:duration>00:34:27</itunes:duration>
			<itunes:keywords>ubc ubcmiami bill white university baptist church miami christian</itunes:keywords>
		</item>
		<item>
			<title>Q1: When the Wind Blows</title>
			<itunes:author>David Wideman</itunes:author>

			<description><![CDATA[Q1: 6/9 Message Series by David Wideman. For more information, visit ubcmiami.org. Copyright 2009 UBCMIAMI #20090056]]></description>
			<itunes:subtitle>Q1: 6/9 Message Series by David Wideman. For more information, visit ubcmiami.org. Copyright 2009 UBCMIAMI #20090056</itunes:subtitle>
			<itunes:summary />
			<enclosure type="audio/mpeg" url="http://www.ubcmiami.org/podcasts/01%20Q1_%20When%20the%20Wind%20Blows.mp3" length="20226656" />
			<guid>http://www.ubcmiami.org/podcasts/01%20Q1_%20When%20the%20Wind%20Blows.mp3</guid>
			<pubDate>Sun, 08 Feb 2009 12:18:19 -0500</pubDate>
			<category>Religion &amp; Spirituality</category>

			<itunes:explicit>clean</itunes:explicit>
			<itunes:duration>00:35:47</itunes:duration>
			<itunes:keywords>ubc ubcmiami bill white university baptist church miami christian</itunes:keywords>
		</item>
		<item>
			<title>Q1: $topping the in$anity</title>
			<itunes:author>Bill White</itunes:author>

			<description><![CDATA[Q1: 5/9 Message Series by Bill White. For more information, visit ubcmiami.org. Copyright 2009 UBCMIAMI #20090055]]></description>
			<itunes:subtitle>Q1: 5/9 Message Series by Bill White. For more information, visit ubcmiami.org. Copyright 2009 UBCMIAMI #20090055</itunes:subtitle>
			<itunes:summary />
			<enclosure type="audio/mpeg" url="http://www.ubcmiami.org/podcasts/01%20Q1_%20%24topping%20the%20in%24anity.mp3" length="22699977" />
			<guid>http://www.ubcmiami.org/podcasts/01%20Q1_%20%24topping%20the%20in%24anity.mp3</guid>
			<pubDate>Sun, 01 Feb 2009 12:03:57 -0500</pubDate>
			<category>Religion &amp; Spirituality</category>

			<itunes:explicit>clean</itunes:explicit>
			<itunes:duration>00:38:09</itunes:duration>
			<itunes:keywords>ubc ubcmiami bill white university baptist church miami christian</itunes:keywords>
		</item>
		<item>
			<title>Q1: Working It Out</title>
			<itunes:author>Bill White</itunes:author>

			<description><![CDATA[Q1: 4/9 Message Series by Bill White. For more information, visit ubcmiami.org. Copyright 2009 UBCMIAMI #20090054]]></description>
			<itunes:subtitle>Q1: 4/9 Message Series by Bill White. For more information, visit ubcmiami.org. Copyright 2009 UBCMIAMI #20090054</itunes:subtitle>
			<itunes:summary />
			<enclosure type="audio/mpeg" url="http://www.ubcmiami.org/podcasts/01%20Q1_%20Working%20It%20Out.mp3" length="17971870" />
			<guid>http://www.ubcmiami.org/podcasts/01%20Q1_%20Working%20It%20Out.mp3</guid>
			<pubDate>Sun, 25 Jan 2009 12:48:04 -0500</pubDate>
			<category>Religion &amp; Spirituality</category>

			<itunes:explicit>clean</itunes:explicit>
			<itunes:duration>00:32:02</itunes:duration>
			<itunes:keywords>ubc ubcmiami bill white university baptist church miami christian</itunes:keywords>
		</item>
		<item>
			<title>Q1: If It Feels Good...</title>
			<itunes:author>Bill White</itunes:author>

			<description><![CDATA[Q1: 3/9 Message Series by Bill White. For more information, visit ubcmiami.org. Copyright 2009 UBCMIAMI #20090053]]></description>
			<itunes:subtitle>Q1: 3/9 Message Series by Bill White. For more information, visit ubcmiami.org. Copyright 2009 UBCMIAMI #20090053</itunes:subtitle>
			<itunes:summary />
			<enclosure type="audio/mpeg" url="http://www.ubcmiami.org/podcasts/Q1_%20If%20It%20Feels%20Good....mp3" length="21251347" />
			<guid>http://www.ubcmiami.org/podcasts/Q1_%20If%20It%20Feels%20Good....mp3</guid>
			<pubDate>Sun, 18 Jan 2009 13:39:38 -0500</pubDate>
			<category>Religion &amp; Spirituality</category>

			<itunes:explicit>clean</itunes:explicit>
			<itunes:duration>00:35:42</itunes:duration>
			<itunes:keywords>ubc ubcmiami bill white university baptist church miami christian</itunes:keywords>
		</item>
		<item>
			<title>Q1: Knowing Better</title>
			<itunes:author>Bill White</itunes:author>

			<description><![CDATA[Q1: 2/9 Message Series by Bill White. For more information, visit ubcmiami.org. Copyright 2009 UBCMIAMI #20090052]]></description>
			<itunes:subtitle>Q1: 2/9 Message Series by Bill White. For more information, visit ubcmiami.org. Copyright 2009 UBCMIAMI #20090052</itunes:subtitle>
			<itunes:summary />
			<enclosure type="audio/mpeg" url="http://www.ubcmiami.org/podcasts/Q1_%20Know%20Better.mp3" length="22119976" />
			<guid>http://www.ubcmiami.org/podcasts/Q1_%20Know%20Better.mp3</guid>
			<pubDate>Sun, 11 Jan 2009 15:10:55 -0500</pubDate>
			<category>Religion &amp; Spirituality</category>

			<itunes:explicit>clean</itunes:explicit>
			<itunes:duration>00:39:58</itunes:duration>
			<itunes:keywords>ubc ubcmiami bill white university baptist church miami christian</itunes:keywords>
		</item>
		<item>
			<title>Q1: Another Dissatisfied Customer</title>
			<itunes:author>Mark Lesher</itunes:author>

			<description><![CDATA[Q1: 1/9 Message Series by Bill White. For more information, visit ubcmiami.org. Copyright 2008 UBCMIAMI #20090051]]></description>
			<itunes:subtitle>Q1: 1/9 Message Series by Bill White. For more information, visit ubcmiami.org. Copyright 2008 UBCMIAMI #20090051</itunes:subtitle>
			<itunes:summary />
			<enclosure type="audio/mpeg" url="http://www.ubcmiami.org/podcasts/01%20Q1_%20Another%20Dissatisfied%20Customer.mp3" length="22907153" />
			<guid>http://www.ubcmiami.org/podcasts/01%20Q1_%20Another%20Dissatisfied%20Customer.mp3</guid>
			<pubDate>Sun, 04 Jan 2009 14:40:58 -0500</pubDate>
			<category>Religion &amp; Spirituality</category>

			<itunes:explicit>clean</itunes:explicit>
			<itunes:duration>00:38:16</itunes:duration>
			<itunes:keywords>ubc ubcmiami bill white university baptist church miami christian</itunes:keywords>
		</item>
		<item>
			<title>Hope City: Connecting the Dots</title>
			<itunes:author>Lyle Green</itunes:author>

			<description><![CDATA[Hope City: Fifth message in a series by Bill White. For more information, visit ubcmiami.org. Copyright 2008 UBCMIAMI #20080050]]></description>
			<itunes:subtitle>Hope City: Fifth message in a series by Bill White. For more information, visit ubcmiami.org. Copyright 2008 UBCMIAMI #20080050</itunes:subtitle>
			<itunes:summary />
			<enclosure type="audio/mpeg" url="http://www.ubcmiami.org/podcasts/01%20Hope%20City_%20Connecting%20the%20Dots.mp3" length="26521108" />
			<guid>http://www.ubcmiami.org/podcasts/01%20Hope%20City_%20Connecting%20the%20Dots.mp3</guid>
			<pubDate>Sun, 28 Dec 2008 14:31:00 -0500</pubDate>
			<category>Religion &amp; Spirituality</category>

			<itunes:explicit>clean</itunes:explicit>
			<itunes:duration>00:44:14</itunes:duration>
			<itunes:keywords>ubc ubcmiami bill white university baptist church miami christian</itunes:keywords>
		</item>
		<item>
			<title>Hope City: The Arrival</title>
			<itunes:author>Bill White</itunes:author>

			<description><![CDATA[Hope City: Fourth message in a series by Bill White. For more information, visit ubcmiami.org. Copyright 2008 UBCMIAMI #20080049]]></description>
			<itunes:subtitle>Hope City: Fourth message in a series by Bill White. For more information, visit ubcmiami.org. Copyright 2008 UBCMIAMI #20080049</itunes:subtitle>
			<itunes:summary />
			<enclosure type="audio/mpeg" url="http://www.ubcmiami.org/podcasts/01%20Hope%20City_%20The%20Arrival.mp3" length="17169194" />
			<guid>http://www.ubcmiami.org/podcasts/01%20Hope%20City_%20The%20Arrival.mp3</guid>
			<pubDate>Wed, 24 Dec 2008 13:30:55 -0500</pubDate>
			<category>Religion &amp; Spirituality</category>

			<itunes:explicit>clean</itunes:explicit>
			<itunes:duration>00:30:33</itunes:duration>
			<itunes:keywords>ubc ubcmiami bill white university baptist church miami christian</itunes:keywords>
		</item>
		<item>
			<title>Hope City: Hope Springs Eternal</title>
			<itunes:author>Bill White</itunes:author>

			<description><![CDATA[Hope City: Fourth message in a series by Bill White. For more information, visit ubcmiami.org. Copyright 2008 UBCMIAMI #20080048]]></description>
			<itunes:subtitle>Hope City: Fourth message in a series by Bill White. For more information, visit ubcmiami.org. Copyright 2008 UBCMIAMI #20080048</itunes:subtitle>
			<itunes:summary />
			<enclosure type="audio/mpeg" url="http://www.ubcmiami.org/podcasts/01%20Hope%20City_%20Hope%20Springs%20Eternal.mp3" length="17750204" />
			<guid>http://www.ubcmiami.org/podcasts/01%20Hope%20City_%20Hope%20Springs%20Eternal.mp3</guid>
			<pubDate>Sun, 21 Dec 2008 12:19:51 -0500</pubDate>
			<category>Religion &amp; Spirituality</category>

			<itunes:explicit>clean</itunes:explicit>
			<itunes:duration>00:31:09</itunes:duration>
			<itunes:keywords>ubc ubcmiami bill white university baptist church miami christian</itunes:keywords>
		</item>
		<item>
			<title>Hope City: Feeling Small in a Big Way</title>
			<itunes:author>Bill White</itunes:author>

			<description><![CDATA[Hope City: Third message in a series by Bill White. For more information, visit ubcmiami.org. Copyright 2008 UBCMIAMI #20080047]]></description>
			<itunes:subtitle>Hope City: Third message in a series by Bill White. For more information, visit ubcmiami.org. Copyright 2008 UBCMIAMI #20080047</itunes:subtitle>
			<itunes:summary />
			<enclosure type="audio/mpeg" url="http://www.ubcmiami.org/podcasts/01%20Hope%20City_%20Feeling%20Small%20in%20a%20Big%20Way.mp3" length="17937854" />
			<guid>http://www.ubcmiami.org/podcasts/01%20Hope%20City_%20Feeling%20Small%20in%20a%20Big%20Way.mp3</guid>
			<pubDate>Sun, 14 Dec 2008 12:50:36 -0500</pubDate>
			<category>Religion &amp; Spirituality</category>

			<itunes:explicit>clean</itunes:explicit>
			<itunes:duration>00:36:27</itunes:duration>
			<itunes:keywords>ubc ubcmiami bill white university baptist church miami christian</itunes:keywords>
		</item>
		<item>
			<title>Hope City: For All the Lonely People</title>
			<itunes:author>Bill White</itunes:author>

			<description><![CDATA[Hope City: Second message in a series by Bill White. For more information, visit ubcmiami.org. Copyright 2008 UBCMIAMI #20080046]]></description>
			<itunes:subtitle>Hope City: Second message in a series by Bill White. For more information, visit ubcmiami.org. Copyright 2008 UBCMIAMI #20080046</itunes:subtitle>
			<itunes:summary />
			<enclosure type="audio/mpeg" url="http://www.ubcmiami.org/podcasts/01%20Hope%20City_%20For%20All%20the%20Lonely%20People.mp3" length="18167741" />
			<guid>http://www.ubcmiami.org/podcasts/01%20Hope%20City_%20For%20All%20the%20Lonely%20People.mp3</guid>
			<pubDate>Sun, 07 Dec 2008 12:53:55 -0500</pubDate>
			<category>Religion &amp; Spirituality</category>

			<itunes:explicit>clean</itunes:explicit>
			<itunes:duration>00:37:30</itunes:duration>
			<itunes:keywords>ubc ubcmiami bill white university baptist church miami christian</itunes:keywords>
		</item>
		<item>
			<title>Hope City: Fearless</title>
			<itunes:author>Bill White</itunes:author>

			<description><![CDATA[Hope City: First message in a series by Bill White. For more information, visit ubcmiami.org. Copyright 2008 UBCMIAMI #20080045]]></description>
			<itunes:subtitle>Hope City: First message in a series by Bill White. For more information, visit ubcmiami.org. Copyright 2008 UBCMIAMI #20080045</itunes:subtitle>
			<itunes:summary />
			<enclosure type="audio/mpeg" url="http://www.ubcmiami.org/podcasts/01%20Hope%20City_%20Fearless.mp3" length="13654596" />
			<guid>http://www.ubcmiami.org/podcasts/01%20Hope%20City_%20Fearless.mp3</guid>
			<pubDate>Sun, 30 Nov 2008 09:38:57 -0500</pubDate>
			<category>Religion &amp; Spirituality</category>

			<itunes:explicit>clean</itunes:explicit>
			<itunes:duration>00:28:05</itunes:duration>
			<itunes:keywords>ubc ubcmiami bill white university baptist church miami christian</itunes:keywords>
		</item>
		<item>
			<title>Squeezed: The Secret of Life in Any Squeeze</title>

	</channel>
</rss>

What I want to do is get this

url="http://www.ubcmiami.org/podcasts/Storming%20the%20Gates%20of%20Hell_%20Your%20Adversary%2C%20the%20Devil.mp3"

which is in the xml file however i want to use php just to grab the url and not the quotes or anything like that. Any idea how I could do that? I tried using stripos, but was lost in how to just get whats in the quotes. Any help will be greatly appreciated.

Thanks

Turns out preg_match() is a lot faster then using SimpleXML.

function benchMark($function, $arg = null, $loops = 1000) {
	echo 'Benchmarking: '.$function.': ';
	$start = microtime(1);
	for($i = 0; $i < $loops; $i++) {
		$function($arg);
	}
	$exec_time = microtime(1)-$start;
	echo $exec_time.'<br />';
	return $exec_time;
}

function preg_find($rss) {
	preg_match_all("/<enclosure type=\"audio\/mpeg\" url=\"([^\"]+)\" length=\"[0-9]+\" \/>/", $rss, $matches);
	return $matches;
}

function str_find($rss) {
	$offset = 0;
	$i = 0;
	$len = strlen($rss);
	
	$search = '<enclosure type="audio/mpeg" url="';
	$searchl = strlen($search);
	
	$urls = array();
	while($start = strpos($rss, $search, $offset)) {
	
		$start = $searchl+$start;
		$end = strpos($rss, '"', $start);
		$substr = substr($rss, $start, $end-$start);
	
		$urls[] = $substr;
		$offset = $end+1;
	
	}
	return $urls;
}

function simplexml_find($rss) {
	$xml = new SimpleXMLElement($rss);
	$encs = $xml->xpath('/rss/channel/item/enclosure');
	$urls = array();
	foreach($encs as $enc) {
		$urls[] = $enc->attributes()->url;
	}
	return $urls;
}


benchMark('preg_find', $rss, 10000);
benchMark('str_find', $rss, 10000);
benchMark('simplexml_find', $rss, 10000);

Results:

Benchmarking: preg_find: 1.3141620159149
Benchmarking: str_find: 0.49334096908569
Benchmarking: simplexml_find: 4.6836819648743

Using strpos() and substr() being the fastest by far.

function str_find($rss) {
	$offset = 0;
	$i = 0;
	$len = strlen($rss);
	
	$search = '<enclosure type="audio/mpeg" url="';
	$searchl = strlen($search);
	
	$urls = array();
	while($start = strpos($rss, $search, $offset)) {
	
		$start = $searchl+$start;
		$end = strpos($rss, '"', $start);
		$substr = substr($rss, $start, $end-$start);
	
		$urls[] = $substr;
		$offset = $end+1;
	
	}
	return $urls;
}

You can turn this into a generic function to find all strings between two strings.

/**
 * Find all sub-strings between two strings in a given string
 * @return Array
 * @param $text String Haystack to Search
 * @param $start_str String Start String
 * @param $end_str String End String
 */
function str_search($text, $start_str, $end_str) {
	$offset = 0;
	$i = 0;
	$len = strlen($text);
	$searchl = strlen($start_str);
	$matches = array();
	while($start = strpos($text, $start_str, $offset)) {
		$start = $searchl+$start;
		$end = strpos($text, $end_str, $start);
		$substr = substr($text, $start, $end-$start);
		$matches[] = $substr;
		$offset = $end+1;
	}
	return $matches;
}

Thanks for the advise I didnt realize it was that much faster. I am using simple xml, and here is my code but i might change to what you used.

<?php // Load and parse the XML document 
$rss =  simplexml_load_file('http://www.ubcmiami.org/podcasts/podcast.xml');
$title =  $rss->channel->title;

// Here we'll put a loop to include each item's title and description
foreach ($rss->channel->item as $item) {
	if($count <= 0)
	{

		$media = $item->guid;
  		$count++;
	}
}
This article has been dead for over six months. Start a new discussion instead.