I want to trasnfer my files on server to another server with port no 220 and SFTP protocol. When I execute following code, my connection to that sever is getting established with correct username and password, but files are not getting transfered on destination.
My local server is Azure and destination is windows server. Kindly suggest.
This is my code I am trying with:
<?php
$localFile='/filepath/file1.txt';
$remoteFile='/remote_server_files/file1.txt';
$host = "hostname";
$port = 220;//Here that server is open with 220 port
$user = "username";
$pass = "password";
echo "<pre>result of connection----".$connection = ssh2_connect($host, $port);
ssh2_auth_password($connection, $user, $pass);
$sftp = ssh2_sftp($connection);
$stream = fopen("ssh2.sftp://$sftp$remoteFile", 'w');
$file = file_get_contents($localFile);
echo "<br>result of file write----".fwrite($stream, $file);
fclose($stream);
?>