Trying to connect to remote sftp using the following code:
if( ! function_exists('ssh2_connect') ){
die( 'Missing ssh2_connect' );
}
$callbacks = array(
'disconnect' => function( $reason, $message, $language ){
printf("Server disconnected with reason code [%d] and message: %s\n",
$reason, $message);
},
'debug' => array( $this , function( $message, $language, $always_display ){
printf("%s %s %s\n",$message,$language,$always_display);
}, )
);
$connection = ssh2_connect( $this->ftp_ip , $this->ftp_port , array() , $callbacks ) or die("Connection failed:");
ssh2_auth_password($connection, $this->ftp_user , $this->ftp_pass );
$sftp = ssh2_sftp($connection);
THe result that i get is "Connection failed"
The remote sftp server requires Explicit FTP over TLS (this is how I use filezilla to connect - and the connection is working)
How can i define Explicit FTP over TLS using ssh2_connect ?
EDIT Tried also connecting with ftp_ssl_connect
$connection = ftp_ssl_connect( $this->ftp_ip , $this->ftp_port ) or die("Connection failed:");
Same result here: "Connection failed"