Pass parameters to command line app and read output? - Poss?
Moderator: General Moderators
Pass parameters to command line app and read output? - Poss?
Is it possible to pass parameters to a command line application and read the output from the command line and then display/email to the user?
Here is the reason for me asking.
I have a product registration page, and the product is free of charge after registering for an unlock code.
Now I obviously wish the user to register themselves, then at some point during the registration (likely when they submit their details) I wish to generate the unlock code based on the serial number which will be a simple auto-generated number in the db.
So this would be the process there after.
Generate Serial number - (DB).
Open command line application.
Pass serial number to app command line.
Simulate 'enter' or 'Return' key hit so app goes away and generates unlock code.
Unlock code then returned to command line.
Then I need to somehow copy unlock code to the db.
I am not sure if this is achievable but I am very willing to discuss the options that may be available and listen to any comments on perhaps how to achieve this.
Cheers
Jim
Here is the reason for me asking.
I have a product registration page, and the product is free of charge after registering for an unlock code.
Now I obviously wish the user to register themselves, then at some point during the registration (likely when they submit their details) I wish to generate the unlock code based on the serial number which will be a simple auto-generated number in the db.
So this would be the process there after.
Generate Serial number - (DB).
Open command line application.
Pass serial number to app command line.
Simulate 'enter' or 'Return' key hit so app goes away and generates unlock code.
Unlock code then returned to command line.
Then I need to somehow copy unlock code to the db.
I am not sure if this is achievable but I am very willing to discuss the options that may be available and listen to any comments on perhaps how to achieve this.
Cheers
Jim
-
magicrobotmonkey
- Forum Regular
- Posts: 888
- Joined: Sun Mar 21, 2004 1:09 pm
- Location: Cambridge, MA
-
magicrobotmonkey
- Forum Regular
- Posts: 888
- Joined: Sun Mar 21, 2004 1:09 pm
- Location: Cambridge, MA
-
magicrobotmonkey
- Forum Regular
- Posts: 888
- Joined: Sun Mar 21, 2004 1:09 pm
- Location: Cambridge, MA
execute will allow the -print output to be stored in an array..
for instance with the find command like this...
..just loop through the resulting array to get your program output.
yes this is only part of your question
for instance with the find command like this...
Code: Select all
<?php
$find=exec("find /usr/local -name "foo*" -print", $findresults);
?>yes this is only part of your question