HTTP HEADERS

They have: 141 posts

Joined: Aug 1999

I was wondering what the enviromental variable for perl/php is for the current url? For example getenv(QUERY_STRING); gives you the query string, what gives you the actuall url?

They have: 334 posts

Joined: Dec 1999

There isn't an easy way. You'll need to combine the $HTTP_HOST and $REQUEST_URI into a single URL string.

Try:

<?php

$full_url
= sprintf("%s%s%s","http://",$HTTP_HOST,$REQUEST_URI);
echo
"$full_url";

?>
'

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

simpler...

<?
print "http://" . $HTTP_HOST . $REQUEST_URI;
?>

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.