ftpWrapper.php
705 Bytes
<?php
/** \file ftpWrapper.php
* \brief FTP Wrapper for FTP Servers passive
*
?
/*Wrapper to FTP - standard wrapper doesn't work in our case - we need passive mode */
function ftpWrapper($ftp_server, $ftp_user_name, $ftp_user_pass, $server_file, $local_file) {
try
{
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
ftp_pasv($conn_id, true);
$ftp_get = ftp_get($conn_id, $local_file, $server_file, FTP_BINARY);
ftp_close($conn_id);
}
catch (Exception $e)
{
return false;
}
return $ftp_get;
}