If you're going to write to a file and then move it to another server just use PHP's fwrite() to write the file:
http://php.net/manual/en/function.fwrite.php Then scp the file to the other server (using stored authentication keys so your security is somewhat maintained). Jeff -- Jeff Slutz JSLEUTH LLC 3242 44th ST APT 3F Astoria, NY 11103 c. 970.443.9390 j...@jeffslutz.com On Wed, Aug 22, 2012 at 7:29 PM, Nicholas Hart <pelha...@gmail.com> wrote: > Hi, > > Thanks for the help with the telnet issue! I am now trying to save text > to a file that is going to be placed on a different server. I planned to > use shell_exec in PHP but cannot seem to get it to work: > > shell_exec('echo testdata > file.txt'); - this doesn't work but > shell_exec('ls > file.txt'); -does work > > trying to get shell_exec('echo '.$str.' > file.txt'); and ultimately: > shell_exec('ssh root@172.20.8.20 "echo '.$str.' > file.txt" '); > > to work but cannot. Perhaps there is a syntax or escape character issue? > Any help appreciated. > > Thanks. > Nick > > _______________________________________________ > New York PHP User Group Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > http://www.nyphp.org/show-participation >
_______________________________________________ New York PHP User Group Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk http://www.nyphp.org/show-participation