|
Posted by Daniel Tryba on 10/25/13 11:21
Martin Kofahl <no@spam> wrote:
> I'm slightly confused with the passthru() command. The program I call writes
> html headers itself. However, passthru() makes apache sending some generated
> headers first. There's no fault with spaches in the code etc, I think.
> Here's an simplified example:
>
>
> $ cat /www/example.php
> <?
> passthru("cat /tmp/output");
> ?>
http://nl3.php.net/passthru
"passthru -- Execute an external program and display raw output"
In PHP's context output is http body, http headers can be set with
headers.
Couple of possibilities:
-tell/make the program not to output it's own headers
-call the program directly as a cgi
-suppress php's header generation
-have php filter the output and extract the headers
The last one might be most approriate:
just read the output (popen/fopen) line line by line. Everything till
the first blank line are headers, so output them using header().
Everything after that is the body and could be sent to the client with
echo.
Navigation:
[Reply to this message]
|