RE: [PHP] Capturing Eval'd things into a variable...
| From: | Roy Nasser | Date: | Mon, 27 Nov 2000 10:27:29 +0000 |
| Subject: | RE: [PHP] Capturing Eval'd things into a variable... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-27322@lists.php.net to get a copy of this message | ||
Where does my server go in these cases? Every request means two or even more
requests to the http server?
Are there any planned functions for this type of thing in PHP?!
I once used a language which had one of the only, and yet most well planned
ways of accomplishing this type of thing...
All you had to do was put what you wanted captured into the default variable
in the middle of two functions, and voila!
such as:
StartCapture();
PHP CODE
EndCapture();
Perl is also a little bit more helpful in thsi aspect, it allows us to at
least use EVAL as a function (ruterns data)...
The use of EVAL is only for running user-given code?
> -----Original Message-----
> From: Jason Brooke [mailto:jason@qgl.org]
> Sent: Monday, November 27, 2000 1:21 AM
> To: Joe Conway; Roy Nasser; Php (E-mail)
> Subject: Re: [PHP] Capturing Eval'd things into a variable...
>
>
>
> Or just $variable = implode('',
>
> file("http://www.yourhost.com/path/to/tagetpage.php"));
>
> jason
>
>
> > 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
>
>
>
>