I have a scenario where I need to update the mysql database from the data in csv file. The csv file is located in FTP server instance of Marketing cloud.
$host = 'ftp.s10.exacttarget.com';
$username = 'XXXX';
$password = 'XXXX';
function scanFilesystem($dir) {
$tempArray = array();
$handle = opendir($dir);
while (false !== ($file = readdir($handle))) {
if (substr("$file", 0, 1) != "."){
if(is_dir($file)){
$tempArray[$file]=scanFilesystem("$dir/$file");
} else {
$tempArray[]=$file;
}
}
}
closedir($handle);
return $tempArray;
}
$SSH_CONNECTION= ssh2_connect($host, 22);
ssh2_auth_password($SSH_CONNECTION, $username, $password);
$sftp = ssh2_sftp($SSH_CONNECTION);
$dir = "ssh2.sftp://$sftp/Export";
$outgoing = scanFilesystem($dir);
sort($outgoing);
print_r($outgoing);
The above code is what I have tried till now to read the files from ftp.s10.exacttarget.com but I keep getting the error below.
Fatal error: Call to undefined function ssh2_connect()
Can anyone help me?