in reply to An unfortunate incounter with PHP (loading php output into a perl variable)

Use Open3, that catch all the output:
use IPC::Open3 ; open3(LOGREAD , LOGERROR, LOGWRITE, "php -q /var/www/html/testing/he +ader.php"); @data = <LOGREAD> ; @error <LOGERROR> ; close(LOGREAD , LOGERROR, LOGWRITE) ; print join("", @data) ;
Open3 is good, since is the more portable option to do that, and you have the write handler too to send data!

Graciliano M. P.
"The creativity is the expression of the liberty".

  • Comment on Re: An unfortunate incounter with PHP (loading php output into a perl variable)
  • Download Code

Replies are listed 'Best First'.
Re: Re: An unfortunate incounter with PHP (loading php output into a perl variable)
by Bishma (Beadle) on May 01, 2003 at 05:20 UTC
    Same deal. It executes fine at the command line and craps out through apache.

    Interesting side note: I tried writing a tempfile with the parsed php data in it and it still didn't work. So I looked at the temp file and it was a mirror of my perl script with "Content-type..." at the top of it.
      What?! Strange!

      Well, try php -q script.php >out.htm

      Ugly, but should work!

      If doen't work you can try to get the PHP output from http://foo/script.php, using any LWP or making a simple IO::Socket::INET. But this is ugly too!

      Graciliano M. P.
      "The creativity is the expression of the liberty".