Hi, I hope someone here could help me, because I couldn't find any solution with Google. What I have to do is to generate a XML-string (that works) an save that directly into a file on an sftp-server.
So far, so good... I used the following code with ftp and it works to, but not with ftps. So I either need another options-configuration for the stream or a different way to solve that task.
Here my current code:
$host = 'ftp.example.com';
$port = 22;
$user = 'xxxxxx';
$pass = 'xxxxxx';
$file = 'test_' . time() . '.txt';
$ftpPath = sprintf('ftp://%s:%s@%s:%d/%s', $user, $pass, $host, $port, $file);
$context = stream_context_create(array('ftp' = array('overwrite' = true)));
file_put_contents($ftpPath, 'test', 0, $context);