PHP Post Data overwrites previous text -


this code using post data txt file on server. got question on stackoverflow:

file_put_contents('test.txt', file_get_contents('php://input')); 

the code overwrites previous text in test.txt everytime. how can make insert? know if use fopen, can make insert adding a+

$file=fopen(date("y-m-d").".txt","a+") 

where should add a+ in file_put_contents?

file_put_contents() supports optional third parameter: $flags. pass flag file_append file_put_contents() make append file rather overwriting it:

file_put_contents('test.txt', file_get_contents('php://input'), file_append); 

Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -