I'm trying to get the complete URL for whatever page I may be on example: http://www.somepage.com/whatever/something/imges/links.php
I always use this, but there might be a better env variable that does the same thing.
$path = "http://".$SERVER_NAME.$PHP_SELF;
The only thing you gotta add is the http so if it's on an SSL socket change that to https://
April