I hope someone here can help me because I could not find a solution with Google. I need to create an XML string (which works) that will be saved directly to a file on the sftp server.
So far so good ... I have used the following code with ftp and it works, but not with ftps. Therefore, I either need another parameter setting for the stream, or another way to solve this problem.
Here is 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);
source share