/** * Open a FTP connection. * * @param string $host * @param bool $ssl * @param int $port * @param int $timeout * * @return FTPClient * @throws FtpException If unable to connect */ public function connect($host, $ssl = false, $port = 21, $timeout = 90) { if ($ssl) { $this->conn = @$this->ftp->ssl_connect($host, $port, $timeout); } else { $this->conn = @$this->ftp->connect($host, $port, $timeout); } if (!$this->conn) { throw new FtpException('Unable to connect'); } return $this; }