title: How to get the domain name without www, subdomain, and com/net/org/etc
body: <p>I just need to get the domain name only form a url, (without com and everything else) example:</p>
  
  <p>I have:</p>
  
  <pre><code>http://www.subdomain.domain1.com/
  www.subdomain.domain2.net
  subdomain.subdomain2.domain3.org/
  http://domain4.com
  </code></pre>
  
  <p>I want to get with PHP:</p>
  
  <pre><code>domain1
  domain2
  domain3
  domain4
  </code></pre>