RE: [PHP] determining script url

2002-02-08 Thread Matt Williams

 Hi all,
 How can I get the full URL of the currently running script? 
 $DOCUMENT_ROOT is not what I need, instead I need the url (be it 
 domain if exists, or ip if not).  $SERVER_NAME works but if a 
 domain isn't paired with the server, I could get some useless 
 information (right?).

$SCRIPT_NAME or $SCRIPT_FILENAME

See http://uk.php.net/manual/en/language.variables.predefined.php

For more details

m:



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] determining script url

2002-02-08 Thread sean

Thanks for the response, but those are just like $DOCUMENT_ROOT, they provide paths in 
the server, I need what is showing up as the URL in the browser - i.e. 
http://www.domain.com/script.php - or if there is no domain, to give me the IP.

any ideas? I can't seem to piece it together with the info from phpinfo() either.

It's so aggravating because the value of what I'm looking for is right on screen, but 
I can't get the php to notice!

Thanks,
Sean

My response for those vars was:
$SCRIPT_NAME: /cgi-bin/php4.cgi
$SCRIPT_FILENAME: /u/httpd/cgi-bin/php4.cgi

-Original Message-
From: Matt Williams [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 08, 2002 1:00 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [PHP] determining script url 


 Hi all,
 How can I get the full URL of the currently running script? 
 $DOCUMENT_ROOT is not what I need, instead I need the url (be it 
 domain if exists, or ip if not).  $SERVER_NAME works but if a 
 domain isn't paired with the server, I could get some useless 
 information (right?).

$SCRIPT_NAME or $SCRIPT_FILENAME

See http://uk.php.net/manual/en/language.variables.predefined.php

For more details

m:


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] determining script url

2002-02-08 Thread bvr



I'd say you should store the base url of your site in a variable somewhere.

then append the REQUEST_URI and you have the url.

or ..

you take the SERVER_NAME, SERVER_PORT and REQUEST_URI .. 
and you might need some other variables to make it recognize SSL and
prefix with httpS ..

bvr.


How can I get the full URL of the currently running script? $DOCUMENT_ROOT is not 
what I need, instead I need the url (be it domain if exists, or ip if not).  
$SERVER_NAME works but if a domain isn't paired with the server, I could get some 
useless 
information (right?).







-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] determining script url

2002-02-08 Thread Jason Wong

On Saturday 09 February 2002 00:17, [EMAIL PROTECTED] wrote:
 Thanks for the response, but those are just like $DOCUMENT_ROOT, they
 provide paths in the server, I need what is showing up as the URL in the
 browser - i.e. http://www.domain.com/script.php - or if there is no domain,
 to give me the IP.

 any ideas? I can't seem to piece it together with the info from phpinfo()
 either.

 It's so aggravating because the value of what I'm looking for is right on
 screen, but I can't get the php to notice!


On my system (Apache + php module):

  'http://' . $HTTP_SERVER_VARS['HTTP_HOST'] . $PHP_SELF

gives the the url as displayed by the browser.

But you seem to be using php as CGI so YMMV.



-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk

/*
Life is a grand adventure -- or it is nothing.
-- Helen Keller
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] determining script url

2002-02-07 Thread Martin Towell

I think what'll you'll need to do is look through the phpinfo() output and
piece together all the parts, eg $HTTP_HOST (or should that be
$_HTTP[HOST] ?), $PHP_SELF, etc.

If anyone knows of a better way, I'd like to know too

Martin


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 08, 2002 3:37 PM
To: [EMAIL PROTECTED]
Subject: [PHP] determining script url 


Hi all,
How can I get the full URL of the currently running script? $DOCUMENT_ROOT
is not what I need, instead I need the url (be it domain if exists, or ip if
not).  $SERVER_NAME works but if a domain isn't paired with the server, I
could get some useless information (right?).

Thanks,

Sean


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php