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:[EMAIL PROTECTED] Sent: Saturday, June 28, 2003 12:11 AM To: [EMAIL PROTECTED] 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 [EMAIL PROTECTED] "Thai Thanh Ha" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > 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 -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php