|
|
#1 (permalink) |
|
Registered User
Join Date: Jan 2003
Location: UK
Posts: 928
|
append to textfile with php
hi,
im wanting to append data to a txt file, i have this so far... PHP Code:
ive looked at the manual and there doesnt seem to be a way of putting the file pointer at the end of the file any help appreciated ![]() thanks Last edited by c0lin; 02-17-2004 at 05:13 AM. |
|
|
|
|
|
#2 (permalink) |
|
Da House Nerd
Join Date: Dec 1969
Location: One CPU Lane
Posts: 3,512
|
![]() 'a' - Open for writing only; place the file pointer at the end of the file. If the file does not exist, attempt to create it. the a of 'append' ![]() taken from the online manual of fopen ![]() RTFM!
__________________
Linux virusscanner detected a virus: Windows 95 ... delete [Y/n] y ~ ~ :wq |
|
|
|
|
|
#3 (permalink) |
|
Registered User
Join Date: Jan 2003
Location: UK
Posts: 928
|
oops,
ok maybe i need glasses or somthing... lol just one more question though (lol)... is there anyway i could run the script from one server and have it write to a text file on another? or is this impossible? thanks again lol Last edited by c0lin; 02-17-2004 at 08:29 AM. |
|
|
|
|
|
#4 (permalink) |
|
Da House Nerd
Join Date: Dec 1969
Location: One CPU Lane
Posts: 3,512
|
yes, it's possible, in various ways:
1. when there is an NFS mount, simply write a file, like it's on the local hierarchy 2. write your own logging daemon, which writes a TCP socket down to a file 3. do it the PHP-way; create a page which writes something to a file, then call that page from the other server using fopen('http://my.server/logpage.php?message=log+this+message'); Of course you can write the logpage.php in such a way it only accepts call from the other server, and rejects all others....
__________________
Linux virusscanner detected a virus: Windows 95 ... delete [Y/n] y ~ ~ :wq |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|