Copy and read a file
| From: | Miguel Br�s | Date: | Fri, 18 Apr 2003 12:04:45 +0000 |
| Subject: | Copy and read a file | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-27162@lists.php.net to get a copy of this message | ||
Hi gents,
I wanna copy a file from a webserver to my webserver everytime someone runs
the script A.
Someone gave me the following lines for it:
******************
$fp = fopen ("http://www.ivan.ivao.org/whazzup.txt",
"r");
while (!feof ($fp))
{
$buffer = fgets($fp, 10000);
$fo = fopen ("data_status.txt","a+");
fputs($fo,$buffer);
}
fclose ($fp);
fclose ($fo);
******************
For sure that this works, but it appends the new file, and i want to delete
all the old data and write the new one on the begin of the file.
Any idea for it?
The other part is that i wanna start on a specific point of the file and
make a search for a word. If i find the word, it continues to look until
eof. Then it returns me all the data found. Any help here also?
Miguel