title: How do I parse a URL in PHP?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/276516/parsing-domain-from-url-in-php">Parsing Domain From URL In PHP</a>  </p>
  </blockquote>
  
  
  
  <p>how do i get </p>
  
  <pre><code>http://localhost/
  </code></pre>
  
  <p>from </p>
  
  <pre><code>http://localhost/something/
  </code></pre>
  
  <p>using php </p>
  
  <p>I tried</p>
  
  <pre><code>    $base  = strtok($url, '/');
  </code></pre>