|
Posted by d on 10/17/54 11:40
"Justin Koivisto" <justin@koivi.com> wrote in message
news:HpSdnUuj8q6aeHHeRVn-jw@onvoy.com...
>d wrote:
>> <francescomoi@usa.com> wrote in message
>> news:1139593886.094217.64410@g43g2000cwa.googlegroups.com...
>>>
>>> Using PHP 4.3.11, I want my script not to write standard output on the
>>> webpage, but on a textfile.
>>>
>>> I tried with:
>>>
>>> [code]
>>> $variableName = 44;
>>> system("/usr/local/php/bin/php /home/foo/script.php >
>>> /home/foo/file.txt", $retval);
>>> [/code]
>>>
>>> But '/home/foo/script.php' doesn't consider $variableName.
>>>
>>> Is there any way to call '/home/foo/script.php' and make it to write
>>> standard output on a textfile?
>>
>> Use output buffering:
>
> I love the ob_* functions myself as well...
>
>> ob_start();
>> system("/bin/date");
>> $c=ob_get_contents();
>> ob_end_clean();
>
> Since your php version is >=4.3.0, "$c=ob_get_clean();" will do the same
> as the last two lines, and IIRC, it's a bit more efficient for cpu cycles.
Indeed :)
> --
> Justin Koivisto, ZCE - justin@koivi.com
> http://koivi.com
[Back to original message]
|