PHP Exec command - How to pass input to a series of questions
        Posted  
        
            by 
                user556597
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by user556597
        
        
        
        Published on 2010-12-29T01:10:09Z
        Indexed on 
            2010/12/29
            1:54 UTC
        
        
        Read the original article
        Hit count: 605
        
I have a program on my linux server that asks the same series of questions each time it executes and then provides several lines of output. My goal is to automate the input and output with a php script.
I know how to capture the output in an array by writing: $out = array(); exec("my/path/program",$out);
But how do I handle the input? Assume the program asks 3 questions and valid answers are: left 120 n What is the easiest way using php to pass that input to the program? Can I do it somehow on the exec line?
I’m not a php noob but simply have never needed to do this before. Alas, my googling is going in circles.
© Stack Overflow or respective owner