I'm trying to write a function which will open a remote file on a server pointed to by $this->CP. This is some of the code that I have :
function get( $filename, $option)
{
if( $option == "")
$option = $this->STRING;
if ( !($this->_connect()))
return false;
$this->filename = $filename;
$this->FP = tmpfile();
$result = ftp_fget( $this->CP, $this->FP, $this->filename, FTP_ASCII);
rewind($this->FP);
if ( !$result)
{
$this->ftp_error = "Could not open $this->filename, on $this->lastHost.";
return false;
}
if( $option == $this->STRING)
{
$string = "";
while ( !feof($this->FP))
{
$string .= fgets($this->FP, 4096);
}
return $string;
The problem is that for jpegs and etc. it opens them with no problem, but when it tries to open a text file this is the error returned ( After a 3 min wait)
Warning: ftp_get: in ./FtpClass.php on line 156 (The line of the ftp_fget() call)