<?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>techNerdia - Web Development Tips &#187; domain</title>
	<atom:link href="http://technerdia.com/tag/domain/feed" rel="self" type="application/rss+xml" />
	<link>http://technerdia.com</link>
	<description>Web Development Tips, Tricks and Ideas</description>
	<lastBuildDate>Tue, 07 Feb 2012 13:43:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>Remove slashes and the http from a URL &#8211; PHP Example</title>
		<link>http://technerdia.com/667_domain-only.html</link>
		<comments>http://technerdia.com/667_domain-only.html#comments</comments>
		<pubDate>Wed, 18 Jan 2012 13:17:41 +0000</pubDate>
		<dc:creator>tribalNerd</dc:creator>
				<category><![CDATA[Functions]]></category>
		<category><![CDATA[PHP Examples]]></category>
		<category><![CDATA[domain]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[preg_replace]]></category>
		<category><![CDATA[urldecode]]></category>
		<guid isPermaLink="false">http://technerdia.com/?p=667</guid>
		<description><![CDATA[Simple PHP Snip, decodes an encoded url, strips away the end slash from the url, then remove the http:// from the URL, leaving only the domain.com to deal with.<p><div style="clear:both;border:2px dashed #c00;text-align:left;font-weight:bold;font-size:16px;padding:8px 10px;margin:40px 10px;text-align:center;">Thanks For Reading <a href="http://technerdia.com/667_domain-only.html">Remove slashes and the http from a URL &#8211; PHP Example</a></b> from <a href="http://technerdia.com/" target="_blank">techNerdia.com</a></div>
<p align="center">~ <b>Visit the New techNerdia.com today</b> ~</p></p>
]]></description>
			<content:encoded><![CDATA[<p>The PHP example below takes an encoded URL, decodes it, then strips away the slashes and http, leaving only the domain.com to deal with.</p>
<p><strong>The Snip:</strong></p>
<div class="mycode"><pre class="brush: php; title: ; notranslate">/* */
echo preg_replace(&quot;/^https?:\/\/(.+)$/i&quot;,&quot;\1&quot;, preg_replace(&quot;{/$}&quot;, &quot;&quot;, urldecode( $website ) ) );
/* */</pre></div>
<h2>Breaking It Down</h2>
<p>It starts by decoding an encoded URL: It turns, http%3A%2F%2Ftechnerdia.com%2F into http://technerdia.com</p>
<p>Why is the URL encoded? I use this snip when pulling URLs from a database. The snip still works if the URL isn&#8217;t encoded.</p>
<p><strong>Decode the Encoded URL</strong>
<div class="mycode"><pre class="brush: php; title: ; notranslate">$website = &quot;http%3A%2F%2Ftechnerdia.com%2F&quot;;
$website = urldecode( $website );
echo $website;
/* Result: http://technerdia.com/ */</pre></div></p>
<p><strong>Removing Trailing Slash from the URL</strong>
<div class="mycode"><pre class="brush: php; title: ; notranslate">$website = &quot;http://technerdia.com/&quot;;
$website = preg_replace( &quot;{/$}&quot;, &quot;&quot;, $website );
echo $website;
/* Result: http://technerdia.com */</pre></div></p>
<p><strong>Remove the http:// from the URL</strong>
<div class="mycode"><pre class="brush: php; title: ; notranslate">$website = &quot;http://technerdia.com&quot;;
$website = preg_replace( &quot;/^https?:\/\/(.+)$/i&quot;,&quot;\1&quot;, $website );
echo $website;
/* Result: technerdia.com */</pre></div></p>
<p><strong>That&#8217;s It!</strong></p>
<p><strong>Make It All One Line</strong><br />
You can stack it all together and simply echo the line, instead of typing all that out.</p>
<div class="mycode"><pre class="brush: php; title: ; notranslate">$website = &quot;http%3A%2F%2Ftechnerdia.com%2F&quot;;
echo preg_replace( &quot;/^https?:\/\/(.+)$/i&quot;,&quot;\1&quot;, preg_replace(&quot;{/$}&quot;, &quot;&quot;, urldecode( $website ) ) );
/* Result: technerdia.com */</pre></div>
<h2>This little snip of code is a time saver, that&#8217;s its job!</h2>
<p>When you insert URL&#8217;s into a database and also need the domain.com inserted, use this to strip away the garbage rather than typing in the domain.com each time. On the flip side, maybe you only have the URL and need the domain.com, which is typical in APIs or building URLs for sites like Alexa and Site Explorer Tools, and of course many other reasons.</p><p><div style="clear:both;border:2px dashed #c00;text-align:left;font-weight:bold;font-size:16px;padding:8px 10px;margin:40px 10px;text-align:center;">Thanks For Reading <a href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tLzY2N19kb21haW4tb25seS5odG1s">Remove slashes and the http from a URL &#8211; PHP Example</a></b> from <a href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tLw==" target=\"_blank\">techNerdia.com</a></div>
<p align="center">~ <b>Visit the New techNerdia.com today</b> ~</p></p>
 <img src="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=667" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://technerdia.com/667_domain-only.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Network Lookup Tools</title>
		<link>http://technerdia.com/41_network-lookup-tools.html</link>
		<comments>http://technerdia.com/41_network-lookup-tools.html#comments</comments>
		<pubDate>Fri, 26 Jan 2007 18:08:00 +0000</pubDate>
		<dc:creator>tribalNerd</dc:creator>
				<category><![CDATA[Online Tools]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[dns lookup]]></category>
		<category><![CDATA[domain]]></category>
		<category><![CDATA[ip]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[network tool]]></category>
		<category><![CDATA[ping]]></category>
		<category><![CDATA[whois]]></category>
		<guid isPermaLink="false">http://technerdia.com/administration/2007/01/26/network-lookup-tools/</guid>
		<description><![CDATA[Perform a Traceroute, Ping, Domain Name Server DNS Lookup, WHOIS, and DNS Records Lookup.<p><div style="clear:both;border:2px dashed #c00;text-align:left;font-weight:bold;font-size:16px;padding:8px 10px;margin:40px 10px;text-align:center;">Thanks For Reading <a href="http://technerdia.com/41_network-lookup-tools.html">Network Lookup Tools</a></b> from <a href="http://technerdia.com/" target="_blank">techNerdia.com</a></div>
<p align="center">~ <b>Visit the New techNerdia.com today</b> ~</p></p>
]]></description>
			<content:encoded><![CDATA[<p>Use the <a target=\"_blank\" title=\"online network tool\" href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5ud3Rvb2xzLmNvbS8=" target=\"_blank\">online network tool</a> to perform a Traceroute, Ping, Domain Name Server DNS Lookup, WHOIS, and DNS Records Lookup. Simply enter the web address or IP address to lookup and <a target=\"_blank\" title=\"network-tools\" href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5ud3Rvb2xzLmNvbS8=" target=\"_blank\">nwtools.com</a> will do the rest for you.</p>
<ul>
	<li><a target=\"_blank\" title=\"nwtools\" href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5ud3Rvb2xzLmNvbS8=" target=\"_blank\">nwtools.com</a></li>
	<li><a target=\"_blank\" title=\"network-tools\" href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL25ldHdvcmstdG9vbHMuY29tLw==" target=\"_blank\">network-tools.com</a></li>
</ul><p><div style="clear:both;border:2px dashed #c00;text-align:left;font-weight:bold;font-size:16px;padding:8px 10px;margin:40px 10px;text-align:center;">Thanks For Reading <a href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tLzQxX25ldHdvcmstbG9va3VwLXRvb2xzLmh0bWw=">Network Lookup Tools</a></b> from <a href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tLw==" target=\"_blank\">techNerdia.com</a></div>
<p align="center">~ <b>Visit the New techNerdia.com today</b> ~</p></p>
 <img src="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=41" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://technerdia.com/41_network-lookup-tools.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

