Help me append a line to a text file in a WebDAV directory from a php script
May 25, 2006 1:44 PM
Subscribe
I want to append a line of text to the end of a text file in a password protected WebDAV directory on my webserver from a normal php webpage outside this directory. Can this be done?
Ideally I have a simple form with a submit button. Upon pressing submit, it should call a php script to do this. I just have no idea how to write the php script. I know enough about php to do this in a regular context. I would also like to be able to run other scripts on this text file and read the text file into other webpages that aren't trapped within the WebDAV directory.
Currently I'm using the iDisk WebDAV but I'm not attached to that and have other WebDAV accounts elsewhere. My webserver is shared Linux hosting.
posted by ontic to computers & internet (6 comments total)
<?php if ($_SERVER['REQUEST_METHOD'] != 'POST') { <form method="post" action="?do=something"> <input name="Submit" type="submit" value="Submit"> </form> } else { if (isset($_REQUEST['do']) && ($_REQUEST['do'] == "something")) { // set the value of the $text and $filename variables here // append $text to $filename exec("cat $text >> $filename",$results); } } ?>posted by Mr. Six at 2:01 PM on May 25, 2006