title: How to get the hostname without TLD from a url
body: <p>I'm in the process of creating a website.  Every time the user uploads a link, I need to save the link and its name/value.  This is hard to explain.</p>
  
  <p>Here's what I'm trying to say.  Lets say the user pastes a link in an input.  <code>https://www.google.com/</code>  The link needs to be saved in an XML file.  When I call the link:</p>
  
  <pre><code>&lt;a href="&lt;?php whatever the php is ?&gt;"&gt; &lt;/a&gt;
  </code></pre>
  
  <p>I want to also call the name:</p>
  
  <pre><code>&lt;a href="&lt;?php whatever the php is ?&gt;"&gt;Google&lt;/a&gt;
  </code></pre>
  
  <p>I want to extract "google" from "<a href="https://www.google.com/" rel="nofollow">https://www.google.com/</a>" </p>
  
  <p>I know I could use: </p>
  
  <pre><code>str_replace(' ', '', )
  </code></pre>
  
  <p>But not all links are the same.
  I know this code won't work because I already tried it. 
  I know the right code is simple probably 3 lines.  So I would really appreciate it if you guys could help me out.</p>
  
  <p>Thank you.</p>