I have some JSON data that I encoded using PHP json_encode() , it looks like this:
{ "site": "site1", "nbrSicEnt": 85, }
What I want to do is write the data directly as a file to an FTP server.
For security reasons, I donβt want the file to be created locally first before sending it to the FTP server, I want it to be created on the fly. Thus, without using tmpfile() for example.
When I read the php documentation for ftp_put :
bool ftp_put ( resource $ftp_stream , string $remote_file , string $local_file , int $mode [, int $startpos = 0 ] )
To write a file to a remote file, you must create a local file ( string $local_file ).
I am looking for a way to write directly to the remote_file. How to do it using PHP?
source share