Forum Moderators: coopster

Message Too Old, No Replies

displaying your page url on the page

using php to retreive page url

         

le_gber

4:21 pm on Nov 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi All,

I'd like to find the function/method/http_header (not sure how to call this) that will return the full path of a document as.

[domain.com...]

This will display the full url of the document it is written on as I want to use it to dynamically generate links to bobby/w3c to check some pages against html validator and accessibility.

This link will be in an include a the bottom of all the pages on my site (~20 pages)

Thanks.

Leo

dreamcatcher

4:45 pm on Nov 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can try the following:

$url = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . "";

echo $url;

Birdman

4:50 pm on Nov 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



$URL = 'http://yourdomain.com/' . $_SERVER['PHP_SELF'] . $_SERVER['QUERY_STRING'];

That'll do it, including query strings!

DaButcher

8:39 pm on Nov 4, 2004 (gmt 0)

10+ Year Member



try this one:
echo "http://{$_SERVER['HTTP_HOST']}{$_SERVER['PHP_SELF']}{$_SERVER['QUERY_STRING']}";