Take url and parse out a part of it
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/7760797/getting-domain-name-without-tld">Getting domain name without TLD</a>  </p>
</blockquote>



<p>So I have a Web site I am trying to work on. In the URL there is info and I want to parse it out and use it to make a db call to mysql:</p>

<p><a href="http://www.relevant-info.org/home.html" rel="nofollow">http://www.relevant-info.org/home.html</a></p>

<p>I want to take the Url put it into a string. </p>

<p>Then I want to only get 'relevant-info'  out of the url.</p>

<pre><code>$webaddress = $_SERVER["SERVER_NAME"];
$parts = parse_url($webaddress);
$url = substr($Parts, 4, -4);
</code></pre>

<p>^ i am using that and I got the ip address (it is a centos 5.8 lamp) on a VM i am testing this, so in short this seams to work good so far :) </p>
