You are here: Re: php newbie want to use php to do the following things « PHP Programming Language « IT news, forums, messages
Re: php newbie want to use php to do the following things

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация