Re: [PHP] How to get the URL into a var?
Hi, have you tried this one? $dir = dirname( $HTTP_SERVER_VARS['PHP_SELF'] ); Moriyoshi Koizumi "Andy" <[EMAIL PROTECTED]> wrote: > Hi there, > > I am trying to find out which dir the user is browsing. How can I get the > URL into a var? I tryed path_info, but it only returns the filename. > > Here is an example: > > URL: http://www.server.com/subapp/test.php > > Should return : > > subapp > > Is this possible?? > > Thanx for any help > > Cheers Andy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to get the URL into a var?
hi, I don't know whether this will solve your problem, but the following prints the full path of the file that is being used. $uri = getenv('REQUEST_URI'); $path = $HTTP_SERVER_VARS["PATH_TRANSLATED"]; // This prints /~user/subapp/test.php echo "
$uri
"; // This prints /home// /public_html/subapp/test.php echo "
path : $path
"; regards - JFK kishor Nilgiri Networks On Sat, 2 Mar 2002, Andy wrote: > Hi there, > > I am trying to find out which dir the user is browsing. How can I get the > URL into a var? I tryed path_info, but it only returns the filename. > > Here is an example: > > URL: http://www.server.com/subapp/test.php > > Should return : > > subapp > > Is this possible?? > > Thanx for any help > > Cheers Andy > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to get the URL into a var?
You can get the requested location from: $_SERVER["QUERY_STRING"] and use the dirname() function on it. bvr. On Sat, 2 Mar 2002 10:29:09 +0100, Andy wrote: >Hi there, > >I am trying to find out which dir the user is browsing. How can I get the >URL into a var? I tryed path_info, but it only returns the filename. > >Here is an example: > >URL: http://www.server.com/subapp/test.php > >Should return : > >subapp > >Is this possible?? > >Thanx for any help > >Cheers Andy > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to get the URL into a var?
>I am trying to find out which dir the user is browsing. How can I get the >URL into a var? I tryed path_info, but it only returns the filename. > >Here is an example: > >URL: http://www.server.com/subapp/test.php > >Should return : > >subapp > >Is this possible?? http://www.php.net/manual/en/language.variables.predefined.php HTH B. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] How to get the URL into a var?
On Saturday 02 March 2002 17:29, Andy wrote: > Hi there, > > I am trying to find out which dir the user is browsing. How can I get the > URL into a var? I tryed path_info, but it only returns the filename. > > Here is an example: > > URL: http://www.server.com/subapp/test.php > > Should return : > > subapp > > Is this possible?? Have a look at $HTTP_SERVER_VARS["SCRIPT_FILENAME"] & $HTTP_SERVER_VARS["PATH_TRANSLATED"] -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk /* Thus mathematics may be defined as the subject in which we never know what we are talking about, nor whether what we are saying is true. -- Bertrand Russell */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] How to get the URL into a var?
Hi there, I am trying to find out which dir the user is browsing. How can I get the URL into a var? I tryed path_info, but it only returns the filename. Here is an example: URL: http://www.server.com/subapp/test.php Should return : subapp Is this possible?? Thanx for any help Cheers Andy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]