Re: Streams - Extensions

From: Date: Mon, 17 May 2004 14:07:20 +0000
Subject: Re: Streams - Extensions
Groups: php.internals 
Request: Send a blank email to internals+get-9893@lists.php.net to get a copy of this message
Hi, I've been looking at the PHP streams source code. I wondered if you could help with this problem i've got with a PHP extension. Any help with this would be very much appreciated! What I want to do is create a php extension which parses php code to the interpreter. e.g. the php script using the php extension will something like this: <?php passCode("echo('Hello World');"); ?> The extension will look something like this: PHP_FUNCTION { char code[128] = "echo('Hello World');"; size_t bt; php_stream * phpStream = php_stream_open_wrapper("php://stdout", "w", REPORT_ERRORS, NULL); if (stream) { zend_printf("Stream Connected"); bt = php_stream_write(phpStream, code, sizeof(code)); php_stream_close(phpStream); } else { zend_printf("Stream Connection Error"); } } This function would pass the code "echo('Hello World');" to PHP and execute it. What I am having problems is, is retrieving the output of this function e.g. "Hello World". But the problem with PHP is that it's unidirectional (oneway) from what I know. Is there a way to read the output from PHP? What would be the best way of doing that? Would it have anything to do with flushing? Thank you very much for your time. Any help with this would be most appreciated. I wanted to ask you, as you are a developer for PHP, and you developed the php streaming for php extensions and c++ programs. I hope it makes sense. Many Regards, Ben Chivers --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.686 / Virus Database: 447 - Release Date: 14/05/2004

« previous php.internals (#9893) next »