Re: Capturing Eval'd things into a variable...
| From: | Joe Conway | Date: | Mon, 27 Nov 2000 03:04:43 +0000 |
| Subject: | Re: Capturing Eval'd things into a variable... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-27295@lists.php.net to get a copy of this message | ||
>I am getting a bit frustrated trying to collect data from php=generated
>pages into variables for use by Caching systems, etc...
>Virtual can't be "piped" into a variable
>Inlclude can't be "piped" into a variable
>Require can't be "piped" into a variable
>Eval can't be "piped" into a variable
I'm not sure I completely understand what you're trying to accomplish, but
it sounds like you want the html output of a php page captured to a
variable. Is that correct?
Assuming it is, why not use fsockopen and make an http request for the page
directly. There are examples in the list archives which give examples, but
it would be something like (untested):
<?PHP
$tgt = "/path/to/targetpage.php";
$host = "http://www.yourhost.com;
$header = "GET " . $tgt . " HTTP/1.0\r\n\r\n";
$fp = fsockopen($host, 80, &$err_num, &$err_msg, 30);
if ($fp) {
// Send everything
fputs($fp, $header);
// Get the response
while (!feof($fp)) {
$response = fgets($fp, 128);
$buf .= $response;
}
echo $buf;
}
Hope this helps,
Joe