So I've made a FTP server, and I'm able to upload files to it. But now I want to display a .log
files content (plain text), but I can't seem to get how this should be done.
I've made a class with this function, and I can see that the uploaded file exists, but how do I print the content of 4404.log
?
function FTP_read(){
ob_end_flush();
$conn_id = ftp_connect($this->ftp_server);
$login_result = ftp_login($conn_id, $this->ftp_user_name, $this->ftp_user_pass);
// get contents of the current directory
$contents = ftp_nlist($conn_id, ".");
// output $contents
var_dump($contents);
}
I thought that I could use ftp_get()
, but why do I have to write to another file?
ftp_get() retrieves a remote file from the FTP server, and saves it into a local file.
Expected to get something like this (print log content):