Capturing script output
| From: | Joel Konkle-Parker | Date: | Thu, 21 Aug 2003 16:17:05 +0000 |
| Subject: | Capturing script output | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-160309@lists.php.net to get a copy of this message | ||
I've got somewhat of a methodology question here. I've got a YaBBSE message
board <http://yabbse.org> that I'm trying to integrate
into my site layout. On a
regular page on my site, I call a page script that defines a body() function and
some variables, then calls template.php to write the page.
What I need to do here is somehow capture the output of the message board script
(index.original.php) and put it into the body() of index.php. I've tried two things:
1. $output = file_get_contents($url); where $url =
'http://server.com/forum/index.original.php?'$SERVER_[QUERY_STRING];
or
something similar
The problem here is that index.original.php relies on POST data, so I can't tell
it everything it needs to know through the query string.
2. ob_start(); require "/dir1/dir2/forum/index.original.php"; $output =
ob_get_contents(); ob_end_clean();
The problem with this is that index.original.php contain calls to ob_end_flush()
and the like, which messes up my output buffering. The effect is such that
ob_start(); require "/dir1/dir2/forum/index.original.php"; ob_end_clean();
produces output.
So I'm stuck. I want to be able to capture the output of the forum script to
include it in my template, but I want to keep it original, so I don't have to
maintain a diff against the original source.
Can anyone offer some advice as to what I should do here?
--
Joel Konkle-Parker
Webmaster [Ballsome.com]
Phone [662-518-1636]
E-mail [jjk3@msstate.edu]