<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>PHP Software Developing &#187; parse_url</title>
	<atom:link href="http://www.phpdeveloping.co.za/tag/parse_url/feed" rel="self" type="application/rss+xml" />
	<link>http://www.phpdeveloping.co.za</link>
	<description>for the love of PHP Development</description>
	<lastBuildDate>Tue, 29 Sep 2009 15:38:14 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Getting information from a URL</title>
		<link>http://www.phpdeveloping.co.za/url/getting-information-from-a-url.html</link>
		<comments>http://www.phpdeveloping.co.za/url/getting-information-from-a-url.html#comments</comments>
		<pubDate>Fri, 14 Aug 2009 07:51:17 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[URL]]></category>
		<category><![CDATA[parse_url]]></category>

		<guid isPermaLink="false">http://www.phpdeveloping.co.za/?p=131</guid>
		<description><![CDATA[Very often you need to be able to pull out parts of the information that is contained within a URL.  Like the port, the protocol, etc.
This is where the parse_url function is so handy.  
Let&#8217;s look at the following code:

  $url_info = parse_url&#40;'http://username:password@www.phpdeveloping.co.za:80/directory/?arg=value#anchor'&#41;;  
  print_r&#40;$url_info&#41;;

The output will be something like:

Array [...]]]></description>
			<content:encoded><![CDATA[<p>Very often you need to be able to pull out parts of the information that is contained within a URL.  Like the port, the protocol, etc.</p>
<p>This is where the <a href="http://www.php.net/manual/en/function.parse-url.php">parse_url</a> function is so handy.  </p>
<p>Let&#8217;s look at the following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">  <span style="color: #000088;">$url_info</span> <span style="color: #339933;">=</span> <span style="color: #990000;">parse_url</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'http://username:password@www.phpdeveloping.co.za:80/directory/?arg=value#anchor'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
  <span style="color: #990000;">print_r</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url_info</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The output will be something like:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">Array</span>  
<span style="color: #009900;">&#40;</span>  
  <span style="color: #009900;">&#91;</span>scheme<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> http  
  <span style="color: #009900;">&#91;</span>host<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> www<span style="color: #339933;">.</span>phpdeveloping<span style="color: #339933;">.</span>co<span style="color: #339933;">.</span>za 
  <span style="color: #009900;">&#91;</span>user<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> username  
  <span style="color: #009900;">&#91;</span>pass<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> password  
  <span style="color: #009900;">&#91;</span>path<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #339933;">/</span>directory  
  <span style="color: #009900;">&#91;</span>port<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #339933;">/</span><span style="color: #cc66cc;">80</span>  
  <span style="color: #009900;">&#91;</span>query<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> arg<span style="color: #339933;">=</span>value  
  <span style="color: #009900;">&#91;</span>fragment<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> anchor  
<span style="color: #009900;">&#41;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.phpdeveloping.co.za/url/getting-information-from-a-url.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
