Well i'm trying to make a script that opens a .txt file from a webserver, writes some stuff in it and closes it. Note that the script.php file is in the same folder wher file.txt is. Here is my code:
<?php
$file = fopen('http://freehost.stuff.gr/lite/file.txt', 'k');
fwrite($file, 'Text');
fclose($file);
?>
Unfortunately i get the following compilation error:
Warning: fopen(http://freehost.stuff.gr/lite/file.txt): failed to open stream: HTTP wrapper does not support writeable connections. in /home/freehost/lite/script.php on line 3
Warning: fwrite(): supplied argument is not a valid stream resource in /home/freehost/lite/script.php on line 4
Warning: fclose(): supplied argument is not a valid stream resource in /home/freehost/lite/script.php on line 5
What is wrong? What should i do to make my code work?