Cannot Detect Current URL - hep me! hep me!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
gilliepit
Forum Newbie
Posts: 9
Joined: Sat Oct 12, 2002 12:52 pm
Location: usa.sc.cola
Contact:

Cannot Detect Current URL - hep me! hep me!

Post by gilliepit »

The first part of my script doesn't seem to be running:

Code: Select all

<?
    $url = "http://" . $HTTP_HOST . $SCRIPT_NAME;
?>
When the variable is echoed, the output is 'http://'

What could be causing this to not detect the host and script and place it into the variable? ( I know it's simple, but the simple things seem to be the most frustrating.. no? :wink: )
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post by hob_goblin »

User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

probably a php-version related problem. then try

Code: Select all

&lt;?php $url = "http://" . $_SERVER&#1111;'HTTP_HOST'] . $_SERVER&#1111;'PHP_SELF']; ?&gt;
gilliepit
Forum Newbie
Posts: 9
Joined: Sat Oct 12, 2002 12:52 pm
Location: usa.sc.cola
Contact:

Post by gilliepit »

volka - thanks, I suppose it was a version issue, your code worked fine..

awesome turnaround, I believe I had to wait all of 10 minutes? maybe?

you guys rock :D
Post Reply