note 86107 modified in function.ftp-fget by danbrown

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
<?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;
    }
}
?>

--was--
/** 
 * 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;
    }
}

http://php.net/manual/en/function.ftp-fget.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.