failed to open stream: HTTP wrapper does not support writeable connections

today encountered in programming error message as shown in the title, the cause is I want to have some written to the log information to a remote a TXT file, the code is as follows:

file_put_contents("", $testData);

the reason for this error is:

HTTP and expect it to be written. Instead You need to open it using the local path.

cannot write to a file remotely via url.

Read More: