File Update
| From: | Chris Earle | Date: | Sun, 30 Jun 2002 19:17:29 +0000 |
| Subject: | File Update | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-20222@lists.php.net to get a copy of this message | ||
I want to be able to update a file on my server (which can be accessed
through FTP). My question is how do I go about accessing it? Do I have to
use the ftp_connect(); functions or can I just go about with something like
this:
---------------------------------------------------
// This doesn't work:
$Location = "ftp://". $Find->USER .":".
$Find->PASS ."@mysite.com/files/".
$Find->BRANCH .".txt";
if (!$fp = fopen($Location, "a"))
{
Error("Error: 0001. File ($Location) could not be found.");
}
else
{
if (!fwrite($fp, $Find->Line)) // line is an HTML tag/link
{
Error("Error: 0002. Information was not written.");
}
if (!fclose($fp))
{
Error("Error: 0003. File close error.");
}
}
---------------------------------------------
I cannot figure out how to access the file and update it (which is just
/file/*.txt from where I'll be accesing it). By update I mean append. I
tried to access it with the complete.
So, what file path do I use to update (append) a file on the same Windows
(2k) server as my web server (/files/*.txt is the location of the file
relative to the PHP code).