Re: Help with exec.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I work by example :)

I can't find enough of an example to get me going with this.

I have this:

$glow = popen('afterglow.pl -c color.properties -s -e 3 -p 1 -l 2000 |
neato -Tpng -o /usr/local/www/test.png','r');

how do I feed my array to that?

Thanks.

On Wed, Mar 3, 2010 at 9:04 AM, Richard Quadling
<rquadling@xxxxxxxxxxxxxx> wrote:
> On 3 March 2010 13:01, Paul Halliday <paul.halliday@xxxxxxxxx> wrote:
>> I need to pipe some data to an external application.
>>
>> I have this:
>>
>> while ($row = mysql_fetch_array($theData[0])) {
>>    $src_ip[] = $row[0];
>>    $dst_ip[] = $row[1];
>>    $sig_desc[] = $row[2];
>>
>>    $rec ++;
>>    if ( $rec == $recCount ) {
>>            break;
>>    }
>> }
>>
>> for ($i = 0; $i < sizeof($src_ip); $i++) {
>>    $tmpResult[] = "$sig_desc[$i],$src_ip[$i],$dst_ip[$i]\n";
>> }
>>
>>
>> The external program is called like:
>>
>> cat results.csv | theprogram outputfilename
>>
>> Is there a way mimic this w/o outputting $tmpResult to a file first?
>>
>> Thanks.
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
> I believe you can use popen() to open "theprogram" and pipe to it the
> content and read back the results. All without writing to any files.
>
>
>
> --
> -----
> Richard Quadling
> "Standing on the shoulders of some very clever giants!"
> EE : http://www.experts-exchange.com/M_248814.html
> EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
> Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
> ZOPA : http://uk.zopa.com/member/RQuadling
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux