I am trying to write to a file (non-existing) using fopen() via ftp. So i try this:
PHP Code:
<?php
$content = "whatever";
$file = "ftp://user:pass@server.com/public_html/dir/9999.txt";
$handle = fopen($file, "w");
if (!$handle)
{
echo "Error opening $file";
}
else {
fwrite ($handle, $content);
echo "success";
fclose($handle);
}
?>
And what i get is an error (echo "Error opening $file"; - that one) and empty 9999.txt
This is really weird, because i think it should work. I checked allow_url_fopen, and its on. In fact, i can't even read any file.
Do you know how can i make this work? Thank you
|