Bug #14165 Updated: No way to return variables from remote include()
| From: | steve at petabit dot com | Date: | Wed, 21 Nov 2001 21:35:15 +0000 |
| Subject: | Bug #14165 Updated: No way to return variables from remote include() | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-71318@lists.php.net to get a copy of this message | ||
ID: 14165
User updated by: steve@petabit.com
Reported By: steve@petabit.com
Status: Bogus
Bug Type: Feature/Change Request
Operating System: Linux
PHP Version: 4.0.5
New Comment:
Dear Brian, Marco et al:
Sorry to be persistent, but I am pretty sure that
my postings have been misunderstood, and the last
reply I just got from Marco confirms it.
I'm hoping once you understand the question, the
"bogus" nature of the question will go away.
According to the php "include()" manual, and
in my own experience, it is perfectly valid to
request that a remote file be executed as php,
using include() or require(). One need only
compile using "URL fopen wrappers": (manual quotes in [[[ ]]])
[[[If "URL fopen wrappers" are enabled in PHP (which they are in the default
configuration), you can specify the file to be include() ed using an URL instead of a local
pathname. See Remote files and fopen() for more information.
]]]
It is also possible to pass variables to the include()ed
file:
[[[ If the require() ed file is called via HTTP using the fopen wrappers, and if the target server
interprets the target file as PHP code, variables may be passed to the require() ed file using an
URL request string as used with HTTP GET. This is not strictly speaking the same thing as require()
ing the file and having it inherit the parent file's variable scope; the script is actually
being run on the remote server and the result is then being included into the local script. ]]]
SO:
The missing feature/doc is:
How do I get the require()ed file to pass back some string information?
I can't use the HTTP GET-style request string, or even the return() function
within an include() (because it only returns an integer).
I don't think this is a bogus request, it seems to me to be a logical
extension of the URL request idea. If it's currently impossible, I'm
looking for a workaround.
Marco's suggestion to print out the database using cvs doesn't change
anything, since I still can't pass a string back.
Best regards,
Steve Rapaport.
Previous Comments:
------------------------------------------------------------------------
[2001-11-21 15:55:06] bate@php.net
Hi,
what are you means with remote?
include("http://www.mysite.com/phpscript.php");
Dont work. the .php are parsed befor and you cant get
source to your script. If you need content from a
database so print's it as csv and use the output in your
script.
http://www.php.net/csv
-- Marco
Btw. Ask this type of question on the general or dev mailing list.
------------------------------------------------------------------------
[2001-11-21 15:47:59] steve@petabit.com
This is not the same as 14164.
Thanks for the quick response, Brian.
I appreciate that the remote file is
parsed remotely, and so the var spaces
are on different machines.
Here's a rephrase of 14165:
Given that it *is* possible to pass
variable values to a remotely INCLUDE()d file
using GET-style syntax,
HOW DOES ONE GET ANYTHING BACK?
Include appears only to return a single integer,
at best.
The remotely included file is calling a database
and retrieving values. How does the calling
file access them?
------------------------------------------------------------------------
[2001-11-21 14:46:07] brianlmoon@php.net
Please do not ask the same question twice in the bug system.
------------------------------------------------------------------------
[2001-11-21 14:38:39] steve@petabit.com
Related to bug 14164:
All workarounds I have tried to pass variable data
back from a remotely include()d or require()d
script have failed.
Arrays and strings don't appear to be passed back in
the include()'s return value, it will only pass back
integers.
If anyone sees another way to do this please help!
I will keep looking and post a followup here and to the
manual if I find a workaround.
Steve Rapaport
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=14165&edit=1