4

[PHP] connection to remote server to edit file

view full story
linux-howto

http://www.linuxquestions.org – I hope this is the correct subforum for my question. I'll give it a try. I have a webGUI in php where users can make certain settings. How can I edit a file on a remote server from my php webserver ? Currently I use my FTP client, vsFTPd and a chrooted user in a specific directory where the file resides. I think this is pretty save as long a nobody else uses my FTPclient. How can I make changes to this file on the remote server from within my php-code on my webserver ?? (so that not I need to make the changes but my users can do it from a html-form) I found this but the credentials for the FTP-connection are plain : <?php $file = fopen ("ftp://login:passwd@server", "w"); if (!$file) { echo "<p>Unable to open remote file for writing.\n"; exit; } /* Write the data here. */ fwrite ($file, "blablabla"); fclose ($file); ?> I use https for the webGUI, but I guess this does not mean the connection to the remote server will be encrypted also ?! Has anyone a safe solution, some documentation on a certain technique that I can use ?? Can I use my FTP-user (has no shell) from within php to edit the file ? (HowTos)