Using PHP to grab the absolute URL of the script?
<p>Basically, I want my script to output its absolute URL, but I don't want to statically program it into the script. For example, if my current URL is <code>http://example.com/script.php</code> I want to be able to store it as a variable, or echo it. i.e. <code>$url = <a href="http://example.com/script.php" rel="nofollow">http://example.com/script.php</a>;</code></p>

<p>But if I move the script to a different server/domain, I want it to automatically adjust to that, i.e. <code>$url = <a href="http://example2.com/newscript.php" rel="nofollow">http://example2.com/newscript.php</a>;</code></p>

<p>But I have no idea how to go about doing this. Any ideas?</p>
