<?php
/**
* Function returns contents via FTP connection and returns it as string (right version...)
*/
function ftp_get_contents ($conn_id, $filename) {
//Create temp handler:
$tempHandle = fopen('php://temp', 'r+');
//Get file from FTP:
if (@ftp_fget($conn_id, $tempHandle, $filename, FTP_ASCII, 0)) {
rewind($tempHandle);
return stream_get_contents($tempHandle);
} else {
return false;
}
}
?>