Capturing console output from proc_open
<p>I'm using proc_open to launch a telnet session connecting to a server program.
Connection is ok but when I get the reply, I can't store the whole string on a file as it is cut after some chars.</p>

<p>Here is my snippet:  </p>

<pre><code>$descriptorSpec = array( 0 =&gt; array( "pipe", "r" ),  
                         1.=&gt; array( "file", $logPath, "w" ) );  
$process = proc_open( "telnet localhost 2323", $descriptorSpec, $pipes );  
fwrite( $pipes[0], "helo" . PHP_EOL );
fwrite( $pipes[0], "quit" . PHP_EOL );
</code></pre>

<p>I've also tried using netcat and exec:  </p>

<pre><code>exec( "echo \"helo quit\" | netcat localhost 2323 &gt;&gt; $logPath" );
</code></pre>

<p>but I had the same result.</p>

<p>If I run the telnet/netcat command from the console, I get the whole string on stdout but if I try to redirect it to another file I get the same prob as above.</p>
