Re: Absolute URLs with Require & Include

From: Date: Fri, 29 Aug 2003 13:08:16 +0000
Subject: Re: Absolute URLs with Require & Include
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-161132@lists.php.net to get a copy of this message
Seth Willits wrote:
Is there anyway to get an absolute URL to work with Require & Include? Why doesn't it work already? I did see the tip about using $_SERVER, but this slows down page-loading considerably.
You can use URLs in your include() or require() calls. include("http://www.google.com"); But... if you try to include a .php page this way, you will get the RESULT of the PHP file being RUN by the server... not the PHP code. Now, if you have an "include.inc" page on another server that is actually PHP code, I guess you could include it using something like the above and it'll be run as PHP code within your script. If you're talking about an absolute PATH, then, yes, that works too: include('/var/www/site/mine/html/htdocs/sub/dir/include.php'); -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com

« previous php.general (#161132) next »