jul 052011
 
<?php
$conn_id = ftp_connect("servidor");
$login_result = ftp_login($conn_id, "user", "pass");
 
ftp_pasv($conn_id, true);
 
if ((!$conn_id) || (!$login_result)) {
echo "FTP connection has failed!";
exit;
} else {
echo "Connected";
}
 
// get the file
$result = ftp_get($conn_id, "arquivo_local.xml","arquivo_remoto.xml", FTP_BINARY);
 
// check upload status
if (!$result) {
echo "FTP download has failed!";
} else {
echo "Downloaded ";
}
 
// close the FTP stream
ftp_close($conn_id);
?>