PHP and fopen()

Da_iMac_Daddy

Not-so-Neo-DumbA$$
I'm trying to set up a webpage that will allow me to update the news for my site from anywhere. I'm using PHP and fopen() to try and edit a a .txt file for use later in the web page. But I can't seem to get PHP to write to the file .....
Here is the code I'm using
Code:
$filename = 'news.txt';
$comment = $_POST['textarea'];
$handle = fopen("ftp://nathacof:*****@dekster.com/www/news.txt", 'r+');
fputs($handle, $comment);
fclose($handle);
exit();

when the Submit button is hit I get this a blank page but the news.txt file hasn't changed. :( Any help?

:edit:
BTW it doesn't seem to be a permissions problem I have news.txt set to be rwx for everyone.
 
Everything seems to be working now with the back end.

All I have to do now is get the file to display on my website. I've made a table which I want to fill with the contents of news.txt and I am trying to use get_file_contents() and then print $fileHandler (which holds the string). The table is showing up but it's empty. Am I doing something wrong?

you can view the source at www.dekster.com/

:edit:

Actually a problem I am having with the back end is when some uses an apostrophe a backslash is displayed in the text file. An escape character I know but how do I filter it out when I plug it into my page?
 
You need to disable the "magic_quotes_gpc" option in your php.ini file to prevent automatic escaping of single-quotes.
 
Back
Top