Try
$pickupFile = new Varien_Io_Ftp();
$localFile$localDir = "/path/to/local/dir";
$remoteFile = "/path/to/remote/dir/text.txt"csv"
mkdir($localFile$localDir, 0700, true);
$localFile = $localDir . '/local.csv'
try {
$pickupFile->open(
array(
'host' => $host,
'user' => $username,
'password' => $password,
'timeout' => '10'
)
);
$pickupFile->read($remoteFile, $localFile);
} catch (Exception $e) {
var_dump($e);
}
See Varien_Io_Ftp
Also for security you way want to use Varien_Io_Sftp