NYCPHP Meetup

NYPHP.org

[nycphp-talk] talk Digest, Vol 70, Issue 1

Jeff Slutz jeff at jeffslutz.com
Thu Aug 23 10:12:54 EDT 2012


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
jeff at jeffslutz.com


On Wed, Aug 22, 2012 at 7:29 PM, Nicholas Hart <pelhamny at 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 at 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20120823/b47e93a1/attachment.html>


More information about the talk mailing list