Dynamically create the full URL to my application
<p>I am able to get my application root using </p>

<pre><code> define("ROOT",dirname(__FILE__); 
</code></pre>

<p>but I need to dynamically get the full URL to where my application resides.</p>

<p>Example location on my drive could be at:</p>

<pre><code> c:\htdocs\website_name\index.php
</code></pre>

<p>then I need:</p>

<pre><code> http://localhost/website_name/
</code></pre>

<p>Preferabbly with the correct protocol (http or https)</p>

<p>I am currently hard coding the location of the application in my config file but have seen that it can be done dynamically.</p>

<p>Any ideas?
I assume using something like $_SERVER['SERVER_NAME'] can give me name but I am not sure how to get he remainder of the variable working.</p>

<p>Any ideas?</p>
