RE: [PHP-WIN] Include()
| From: | Shrock, Court | Date: | Tue, 22 Jan 2002 00:38:03 +0000 |
| Subject: | RE: [PHP-WIN] Include() | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-11547@lists.php.net to get a copy of this message | ||
Yes, it works on Linux/Apache. But the results are not what you might
expect. When one normally uses the include statement, you intend to process
some php file, not the output from such a file.
For example:
nfo.php contains, located at http://www.myserver.com/nfo.php :
------BEGIN FILE---------
<?php
function nfo($addr) {
return getnamebyaddr($addr);
}
echo nfo($REMOTE_ADDR);
?>
-------END FILE-----------
test.php contains, located at http://www.otherserver.com/test.php :
------BEGIN FILE---------
<?php
include('http://www.myserver.com/nfo.php');
echo nfo($REMOTE_ADDR);
?>
-------END FILE-----------
When you visit http://www.otherserver.com/test.php, the nfo
function is not
defined, but results are returned by the include because the server connects
to http://www.myserver.com and correctly includes the results
(output) from
that visit. It is essentially an alternative to
fopen('http://www.myserver.com/nfo.php') if you just
want to echo all the
results of the fopen.
-----Original Message-----
You are right, it doesn't seem to work with windows, I don't know if it
works with *nix either?