RE: [PHP] Capturing Eval'd things into a variable...
| From: | Roy Nasser | Date: | Mon, 27 Nov 2000 21:21:38 +0000 |
| Subject: | RE: [PHP] Capturing Eval'd things into a variable... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-27446@lists.php.net to get a copy of this message | ||
I guess i found a small practical solution to the include problem....
Just do an Include, and then in the included file, put all your code into a
Function, and name it a standard thing, that you can always remember....
Thatway, you can have an
Include("fffffffff");
$Out = RunIncluded();
DoWhateverWith($Out);
I just have one more question... I know that i can do something like:
$Var = "VariableName";
echo $$Var;
and it will be the same as
echo $VariableName;
Now is there a way to do this with a funciton?
Such as:
$Fun = "FunctionName";
$Fun();
being the same as FunctionName();
This is because i might be including several files, and would have a problem
with them all having the same function name inside... Any ideas?
Thanks!
PS: Still no clue on what to do about Virtual... :(((
> -----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
>
>
>
>