Re: How to get the URL into a var?
| From: | J.F.Kishor | Date: | Tue, 05 Feb 2002 12:48:22 +0000 |
| Subject: | Re: How to get the URL into a var? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-83588@lists.php.net to get a copy of this message | ||
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.
<script language="php">
$uri = getenv('REQUEST_URI');
$path = $HTTP_SERVER_VARS["PATH_TRANSLATED"];
// This prints /~user/subapp/test.php
echo "<br>$uri<br>";
// This prints /home/<servername>/<username>/public_html/subapp/test.php
echo "<br>path : $path<br>";
</script>
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: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>