Posted by Colin McKinnon on 08/18/05 11:21
werdna.sivad@gmail.com wrote:
> In PHP I need to be able to execute another script from inside another
> and catch the output. How do I do this? The require() and include()
> functions will execute a script, but it sends the output to the
> browser, I don't want this. I need to be able to catch the output and
> store it in a file or perform logic on it.
>
> I've tried doing fopen and hitting the script that way, but the problem
> is that doing this kills the session state as if I were a 3rd party
> user accessing the system. Any ideas?
Its not very clear what you're trying to acheive here. Taking a wild stab in
the dark....you want to access the page but using the same session id? If
so, you just need to either pass the sessionid in the request variables or
tell the target page that you have it in a cookie. The former can be done
(using GET vars) with the file() and file_get_contents() functions
(assuming config allows it) while the latter needs the libcurl extensions
in PHP (or a lot of coding).
C.
[Back to original message]
|