<?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>Mon, 07 May 2012 16:46:34 +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="border-top:1px dotted #cccccc;clear:both;font-size:14px;font-weight:bold;margin:2px 10px;padding:0 10px;text-align:left;"><ul><li><b>New Wordpress Plugin</b> <a
href="http://technerdia.com/projects/adminbar/plugin.html" target="_blank">WP My Admin Bar</a> (It's Free, Download Today!)</li><li><b>Reading:</b> <a
href="http://technerdia.com/667_domain-only.html">Remove slashes and the http from a URL &#8211; PHP Example</a> <b>By:</b> <a
href="https://plus.google.com/105408082571454010152/" target="_blank">tribalNerd</a> <b>From:</b> <a
href="http://technerdia.com/" target="_blank">techNerdia - Web Development Tips</a></li><li><b><a
href="https://plus.google.com/u/0/108046225913965315594/posts" target="_blank">Follow techNerdia on Google+</a></li></ul></div><p
align="center">~ <b>Thank you for subscribing to techNerdia.com - Please Share This Post With Others</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 name="code" class="php">preg_replace( "#^[^:/.]*[:/]+#i", "", preg_replace( "{/$}", "", urldecode( $website ) ) );</pre></div><ul
class="buttOptions two"><li><a
href="http://demo.technerdia.com/remove-slashes/" target="_blank" class="postButton" onClick="javascript: _gaq.push(['_trackPageview', 'Remove slashes and the http from a URL &#8211; PHP Example', 'VIEW', 'Remove slashes and the http from a URL &#8211; PHP Example']);"><span>View the Demo</span></a></li><li><a
href="http://technerdia.com/files/php-example-remove-all-slashes.pdf" target="_blank" class="postButton" onClick="javascript: _gaq.push(['_trackPageview', '/files/php-example-remove-all-slashes.pdf', 'PDF', '/files/php-example-remove-all-slashes.pdf']);"><span>Download PDF</span></a></li></ul><div
class="br">&nbsp;</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 name="code" class="php">$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 name="code" class="php">$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 name="code" class="php">$website = &quot;http://technerdia.com&quot;;
$website = preg_replace( "#^[^:/.]*[:/]+#i", "", $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 name="code" class="php">$website = &quot;http%3A%2F%2Ftechnerdia.com%2F&quot;;
echo preg_replace( "#^[^:/.]*[:/]+#i", "", preg_replace( "{/$}", "", urldecode( $website ) ) );
/* Result: technerdia.com */</pre></div><ul
class="buttOptions two"><li><a
href="http://demo.technerdia.com/remove-slashes/" target="_blank" class="postButton" onClick="javascript: _gaq.push(['_trackPageview', 'Remove slashes and the http from a URL &#8211; PHP Example', 'VIEW', 'Remove slashes and the http from a URL &#8211; PHP Example']);"><span>View the Demo</span></a></li><li><a
href="http://technerdia.com/files/php-example-remove-all-slashes.pdf" target="_blank" class="postButton" onClick="javascript: _gaq.push(['_trackPageview', '/files/php-example-remove-all-slashes.pdf', 'PDF', '/files/php-example-remove-all-slashes.pdf']);"><span>Download PDF</span></a></li></ul><div
class="br">&nbsp;</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><hr
/><h4>If you've enjoyed this article then please leave me some <a
href="http://technerdia.com/feedback.html" target="_blank">feedback</a>, thanks!</h4><br
/><p><div
style="border-top:1px dotted #cccccc;clear:both;font-size:14px;font-weight:bold;margin:2px 10px;padding:0 10px;text-align:left;"><ul><li><b>New WordPress Plugin</b> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tL3Byb2plY3RzL2FkbWluYmFyL3BsdWdpbi5odG1s" target=\"_blank\">WP My Admin Bar</a> (It's Free, Download Today!)</li><li><b>Reading:</b> <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>By:</b> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cHM6Ly9wbHVzLmdvb2dsZS5jb20vMTA1NDA4MDgyNTcxNDU0MDEwMTUyLw==" target=\"_blank\">tribalNerd</a> <b>From:</b> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tLw==" target=\"_blank\">techNerdia - Web Development Tips</a></li><li><b><a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cHM6Ly9wbHVzLmdvb2dsZS5jb20vdS8wLzEwODA0NjIyNTkxMzk2NTMxNTU5NC9wb3N0cw==" target=\"_blank\">Follow techNerdia on Google+</a></li></ul></div><p
align="center">~ <b>Thank you for subscribing to techNerdia.com - Please Share This Post With Others</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="border-top:1px dotted #cccccc;clear:both;font-size:14px;font-weight:bold;margin:2px 10px;padding:0 10px;text-align:left;"><ul><li><b>New Wordpress Plugin</b> <a
href="http://technerdia.com/projects/adminbar/plugin.html" target="_blank">WP My Admin Bar</a> (It's Free, Download Today!)</li><li><b>Reading:</b> <a
href="http://technerdia.com/41_network-lookup-tools.html">Network Lookup Tools</a> <b>By:</b> <a
href="https://plus.google.com/105408082571454010152/" target="_blank">tribalNerd</a> <b>From:</b> <a
href="http://technerdia.com/" target="_blank">techNerdia - Web Development Tips</a></li><li><b><a
href="https://plus.google.com/u/0/108046225913965315594/posts" target="_blank">Follow techNerdia on Google+</a></li></ul></div><p
align="center">~ <b>Thank you for subscribing to techNerdia.com - Please Share This Post With Others</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="border-top:1px dotted #cccccc;clear:both;font-size:14px;font-weight:bold;margin:2px 10px;padding:0 10px;text-align:left;"><ul><li><b>New WordPress Plugin</b> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tL3Byb2plY3RzL2FkbWluYmFyL3BsdWdpbi5odG1s" target=\"_blank\">WP My Admin Bar</a> (It's Free, Download Today!)</li><li><b>Reading:</b> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tLzQxX25ldHdvcmstbG9va3VwLXRvb2xzLmh0bWw=">Network Lookup Tools</a> <b>By:</b> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cHM6Ly9wbHVzLmdvb2dsZS5jb20vMTA1NDA4MDgyNTcxNDU0MDEwMTUyLw==" target=\"_blank\">tribalNerd</a> <b>From:</b> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tLw==" target=\"_blank\">techNerdia - Web Development Tips</a></li><li><b><a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cHM6Ly9wbHVzLmdvb2dsZS5jb20vdS8wLzEwODA0NjIyNTkxMzk2NTMxNTU5NC9wb3N0cw==" target=\"_blank\">Follow techNerdia on Google+</a></li></ul></div><p
align="center">~ <b>Thank you for subscribing to techNerdia.com - Please Share This Post With Others</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>
