Re: [PHP] PHP script and external C program
http://www.php.net/popen Process Handling. > - Original Message - > From: "John Holmes" <[EMAIL PROTECTED]> > To: "'ing.Martin Prá¹ek'" <[EMAIL PROTECTED]>; > <[EMAIL PROTECTED]> Sent: Monday, May 27, 2002 8:28 PM > Subject: RE: [PHP] PHP script and external C program > > >> I don't have example code, but what you want is the exec() function. >> Be careful passing user variables to a command line program. > > In PHP docs it seems,that exec() does not solve my problem . It is > easy to grab output of "mycomand" to an array, but it seems , that > there is no way to feed "mycommand"s STDIN with something, ie > commandline is only way to pass some argument or data for > "mycomand". > > > I need something like this hypotetical example: > > /bin/mycommand < $variable > $parsed_variable > or > $variable | /bin/mycommand | $parsed_variable > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- Dan Hardiker [[EMAIL PROTECTED]] ADAM Software & Systems Engineer First Creative Ltd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP script and external C program
- Original Message - From: "John Holmes" <[EMAIL PROTECTED]> To: "'ing.Martin Prášek'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, May 27, 2002 8:28 PM Subject: RE: [PHP] PHP script and external C program > I don't have example code, but what you want is the exec() function. Be > careful passing user variables to a command line program. In PHP docs it seems,that exec() does not solve my problem . It is easy to grab output of "mycomand" to an array, but it seems , that there is no way to feed "mycommand"s STDIN with something, ie commandline is only way to pass some argument or data for "mycomand". I need something like this hypotetical example: /bin/mycommand < $variable > $parsed_variable or $variable | /bin/mycommand | $parsed_variable -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP script and external C program
exec wont work if you need to use stdin and read from stdout. You can try php.net/pcntl but that is disabled by default, and probably wont be enabled oun your host. I don't even know if it existed in 4.0.6... -- If there is no higher reason--and there is none--then my own reason must be the supreme judge of my life. Leo Nikolaevich Tolstoy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP script and external C program
I don't have example code, but what you want is the exec() function. Be careful passing user variables to a command line program. www.php.net/exec ---John Holmes... > -Original Message- > From: ing.Martin Prášek [mailto:[EMAIL PROTECTED]] > Sent: Monday, May 27, 2002 1:21 PM > To: [EMAIL PROTECTED] > Subject: [PHP] PHP script and external C program > > Problem. I have a php 4.0.6. on linux as Apache module. I need to do > folowing: > > I have in my script some value, for example "$value" > and > in /bin on my linux box c language program called "something". (I need > speed) . > > I need to parse $value thru stdin /bin/something program to get from its > stdout a $parsed_value. > > How to run external program (for example /bin/something ), write to its > STDIN $value and then read from its STDOUT to variable $parsed_value ? > > > Example code needed. > > > thanx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP script and external C program
Problem. I have a php 4.0.6. on linux as Apache module. I need to do folowing: I have in my script some value, for example "$value" and in /bin on my linux box c language program called "something". (I need speed) . I need to parse $value thru stdin /bin/something program to get from its stdout a $parsed_value. How to run external program (for example /bin/something ), write to its STDIN $value and then read from its STDOUT to variable $parsed_value ? Example code needed. thanx