|  | Posted by Noodle on 10/13/06 08:07 
fAnSKyer wrote:> I wanna use a textarea and a submit to transfer the text area into a
 > file.
 >
 > and then the PHP program using a .exe program open this file,
 > processing the file, and save the output in another file
 >
 > then PHP will open this file and update the html within the text file
 > and send to the customer
 >
 > My question is:
 >
 > if this possible?
 > what if the users input is not valid for the .exe file? how to analyze
 > this in php?
 > what if multiple users click this php file?
 >
 > Thanks a lot, or would you please give me some examples on this.
 >
 > Cheers
 > fAnS.
 
 Capturing the input is quite easy:
 
 <form action="<?php echo basename(__FILE__); ?>" method="post">
 <textarea name="text"></textarea>
 <input type="submit" value="submit" />
 </form>
 
 <?php
 if(!empty($_REQUEST['text']))
 {
 $filename = 'tmp/'.time() . '.txt';
 file_put_contents($filename, $_REQUEST['text']);
 }
 
 ?>
 
 The outputted file can then be processed by the .exe using the system
 command.
 
 <?php
 system('myexe.exe ' . $filename);
 ?>
 
 Then take the return of the .exe output and mail it to the client using
 the mail function.
 
 <?php
 mail('client@somewhere.com', 'heres that file', $filename);
 ?>
 
 Just some ideas. If you give more information about the processing,
 there may be a better solution then calling an .exe file.
  Navigation: [Reply to this message] |