RE: [PHP-WIN] Re: PHP application URL
| From: | Thai Thanh Ha | Date: | Fri, 27 Jun 2003 07:50:12 +0000 |
| Subject: | RE: [PHP-WIN] Re: PHP application URL | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-20594@lists.php.net to get a copy of this message | ||
Cristian,
The problem here is the code (in a PHP page, e.g. utils.php) will be called
from other PHP pages in my application. And I want to always get the same
URL, for example (http://myhost/myapp/). How to use the preg_replace
function to get my *base* URL?
-----Original Message-----
From: Cristian MARIN [mailto:cristic@iakt.rdsnet.ro]
Sent: Saturday, June 28, 2003 12:11 AM
To: php-windows@lists.php.net
Subject: [PHP-WIN] Re: PHP application URL
To know the full URL of a called page you can use this:
$url='http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']
;
After this with preg_replace you can do what ever you want to with the URL.
--
-------------------------------------------------
Cristian MARIN - Developer
InterAKT Online (www.interakt.ro)
Tel: +4021 312.53.12
Tel/Fax: +4021 312.51.91
cristic@interakt.ro
"Thai Thanh Ha" <thaiha@psv.com.vn> wrote in message
news:0531BED80997D6119B9B00D0B748B66A13ECAA@MAIL...
>
> Hi all,
>
> I want to get the URL of my application (and don't want to define it in a
> config file - I don't like telling my customers to config the app, even
run
> some install.php file). Anyone has code for this? I know that in generally
I
> cannot use a PHP function for this because we don't have true "PHP web
> applications" (like Java-based web applications) ( and most of the PHP
> applications define constants, like APP_BASE_URL,...). But I guess if I
put
> a special file (like "APP_ROOT") in my base application directory, I can
> find out the application URL from the URL of the requested file and file
> path of the requested file (The code for determining URL can be put in
> another PHP file and be included). Anyone have code like this? Please help
> me. Thanks in advance.
>
> Thai
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php