Re: Capturing Eval'd things into a variable...
| From: | clayton collie | Date: | Mon, 27 Nov 2000 16:21:10 +0000 |
| Subject: | Re: Capturing Eval'd things into a variable... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-27393@lists.php.net to get a copy of this message | ||
Roy,
have a look at the online manual for the Output Buffering functions. they
may be what youre after ...
> 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
> >
> >
> >
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>