Copy and read a file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux